0.2.1 • Published 9 years ago
latest-lib v0.2.1
latest-lib 
Get the latest version of a CSS or JavaScript library hosted on CDNJS
Install
$ npm install --save latest-libUsage
const latestLib = require('latest-lib');
// search for the latest version of bootstrap
latestLib('bootstrap')
.then(library => console.log(library))
//=> {name: 'twitter-bootstrap', version: '4.0.0-alpha.6', files: [...]}
.catch(err => console.log(err));
// search for the latest version of bootstrap 3
latestLib('bootstrap@3')
.then(library => console.log(library))
//=> {name: 'twitter-bootstrap', version: '3.3.7', files: [...]}
.catch(err => console.log(err));API
latestLib(name, opts)
Returns a Promise containing an object with the following properties:
- On success:
- name
String - version
String - files
Array
- name
- On error:
- an
Errorobject
- an
name
Type: String
The name of the library
Suffixing the name with @[number] will fetch the latest version of [number] major release
opts
Type: Object
only
Type: String
Possible choices:
css- return only the
.cssfiles of the library in the response
- return only the
js- return only the
.jsfiles of the library in the response
- return only the
License
MIT © Gabriel Mangiurea