Skip to main content

@std/semver@1.0.3
Built and signed on GitHub Actions

Parsing and comparing of semantic versions (SemVer)

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a month ago (1.0.3)
function parse
parse(value: string): SemVer

Attempt to parse a string as a semantic version, returning a SemVer object.

Examples

Usage

import { parse } from "@std/semver/parse";
import { assertEquals } from "@std/assert";

const version = parse("1.2.3");
assertEquals(version, {
  major: 1,
  minor: 2,
  patch: 3,
  prerelease: [],
  build: [],
});

Parameters

value: string

The version string to parse

Return Type

A valid SemVer

Add Package

deno add jsr:@std/semver

Import symbol

import { parse } from "@std/semver";

---- OR ----

Import directly with a jsr specifier

import { parse } from "jsr:@std/semver";

Add Package

npx jsr add @std/semver

Import symbol

import { parse } from "@std/semver";

Add Package

yarn dlx jsr add @std/semver

Import symbol

import { parse } from "@std/semver";

Add Package

pnpm dlx jsr add @std/semver

Import symbol

import { parse } from "@std/semver";

Add Package

bunx jsr add @std/semver

Import symbol

import { parse } from "@std/semver";