Package Exports
- parse-packagejson-name
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parse-packagejson-name) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
parsePackageJsonName
A very simple package to parse an npm package name and return some mildly interesting details about the name. It gives you back the following properties:
- scope: The scope of the package, e.g.
@foo/blip.blop
's scope is'foo'
- fullName: The full name of the package, minus the scope, e.g.
@foo/blip.blop
's fullName is'blip.blop'
- projectName: If there is a
.
character in the fullName, then this can denote the module is part of a larger project, for examplelodash
has modules likelodash.pluck
. Given the@foo/blip.blop
example, projectName would be'blip'
- moduleName: Just like above - for our example of
@foo/blip.blop
, moduleName would be'blop'
.
Example
var parsePackageJsonName = require('parsePackageJsonName');
parsePackageJsonName('@foo/blip.blop').should.deep.equal({
scope: 'foo',
fullName: 'blip.blop',
projectName: 'blip',
moduleName: 'blop',
});
parsePackageJsonName('blip.blop').should.deep.equal({
scope: null,
fullName: 'blip.blop',
projectName: 'blip',
moduleName: 'blop',
});
parsePackageJsonName('blop').should.deep.equal({
scope: null,
fullName: 'blop',
projectName: null,
moduleName: 'blop',
});
parsePackageJsonName(require('lodash.pluck/package.json')).should.deep.equal({
scope: null,
fullName: 'lodash.pluck',
projectName: 'lodash',
moduleName: 'pluck',
});