Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/semver/compare.ts>compare

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function compare
import { compare } from "https://deno.land/std@0.216.0/semver/compare.ts";

Compare two semantic version objects.

Returns 0 if s0 === s1, or 1 if s0 is greater, or -1 if s1 is greater.

Sorts in ascending order if passed to Array.sort(),

Returns

1 | 0 | -1