@pobedit/package-name-parser
v1.0.0
Published
A package name parser
Downloads
5
Maintainers
Readme
@pobedit/package-name-parser
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/[email protected]');
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/[email protected]');
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