module-normalize
Normalize a module id or module url.
Install
$ npm install module-normalize --save
Usage
var normalize = ; normalizeid'jquery'; // 'jquery@*'normalizeid'jquery/jquery.js'; // 'jquery@*/jquery.js'normalizeid'jquery@1.9.0'; // 'jquery@1.9.0' // scoped module idnormalizeid'@facebook/jquery/jquery.js'; // '@facebook/jquery/*/jquery.js' normalize // '/jquery/*/jquery.js'normalize; // '/facebook/jquery/*/jquery.js' // specify scopemormalize;// '/facebook/jquery/2.0.0/jquery.js'
normalize.parse_id(id)
@<scope>/<name>@<version><path>
Returns Object
- scope the package scope, default to
''
- name the name of the package
- version the version of the package, default ot
'*'
if not specified. - path defualt to
''
- id the normalized id
- package package is the subtle string of
id
excludingpath
License
MIT