https://github.com/mastilver/module-to-cdn
https://github.com/mastilver/module-to-cdn
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/mastilver/module-to-cdn
- Owner: mastilver
- License: mit
- Created: 2017-03-14T19:18:58.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-26T05:17:59.000Z (over 3 years ago)
- Last Synced: 2025-03-06T10:17:22.262Z (over 1 year ago)
- Language: JavaScript
- Size: 59.6 KB
- Stars: 46
- Watchers: 3
- Forks: 32
- Open Issues: 13
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# module-to-cdn [](https://travis-ci.org/mastilver/module-to-cdn) [](https://greenkeeper.io/)
> Get cdn config from npm module name
## Install
```
$ npm install --save module-to-cdn
```
## Usage
```js
const moduleToCdn = require('module-to-cdn');
moduleToCdn('react', '15.3.0');
/* => {
name: 'react',
var: 'React',
url: 'https://unpkg.com/react@15.3.0/dist/react.min.js',
version: '15.3.0'
}
*/
```
## API
### moduleToCdn(moduleName, version, options)
return the result `Object` or null (if module couldn't be find)
#### moduleName
Type: `string`
The name of the module
#### version
Type: `string`
The version of the module
#### options
##### options.env
Type: `string`
Values: `development`, `production`
Default: `development`
### Result
* `name`: name of the module
* `var`: name of the global variable exposing the module
* `url`: url where the module is available
* `version`: the version asked for
## License
MIT © [Thomas Sileghem](http://mastilver.com)