1.0.0 • Published 4 years ago

@pobedit/package-name-parser v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@pobedit/package-name-parser

Build Status License

A package name parser.

Installation

Install with npm or Yarn:

npm:

npm install @pobedit/package-name-parser --save

Yarn:

yarn add @pobedit/package-name

Basic usage

import {parse} from '@pobedit/package-name-parser';

try {
    const {scope, name, version} = parse('@foo/bar@0.0.1');

    console.log(scope, name, version);
    /*
    {
        scope: 'foo',
        name: 'bar',
        version: '0.0.1'
    }
    */
}
catch ({message}) {
    console.error(message);
}

scope and version are optional:

parse('foo');
parse('@foo/bar');
parse('@foo/bar@0.0.1');

Contributing

Feel free to submit a pull request if you find any bugs. Please make sure all commits are properly documented.

Tests

npm test

Publishing

npm publish --access public --verbose

License

MIT