Socket
Book a DemoInstallSign in
Socket

@scrambled/parse-version

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scrambled/parse-version

Takes a version in an NPM format and returns an object

1.0.3
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created
Source

Parse Version

Takes a version in a format produced by NPM (e.g. "1.9.4") and returns an object like:

{
  major: 1,
  minor: 9,
  patch: 4
}

Throws if version string is incorrect.

Install

npm install @scrambled/parse-version

Use

const parse = require("@scrambled/parse-version");

const { name, version } = require("../package.json");

const project = {
  name,
  version: parse(version)
};

JSON.stringify(project, null, 2) === `{
  "name": "my-awesome-project",
  "version": {
    "major": 1,
    "minor": 0,
    "patch": 9997
  }
}`
// true

Develop

Clone the repository and hack on. Check out friendly NPM scripts:

npm run develop   # Watch and run tests
npm run debug     # Run tests with node inspector

PRs are very welcome.

FAQs

Package last updated on 05 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.