1
+ # pkginfo
1
2
[ ![ Build Status] ( https://travis-ci.org/ultrox/pkginfo.svg?branch=master )] ( https://travis-ci.org/ultrox/pkginfo )
2
3
[ ![ version] ( https://img.shields.io/npm/v/@ma.vu/pkginfo.svg?style=flat-square )] ( http://npm.im/@ma.vu/pkginfo )
3
4
[ ![ MIT License] ( https://img.shields.io/npm/l/pkginfo.svg?style=flat-square )] ( http://opensource.org/licenses/MIT )
4
5
[ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square )] ( https://github.com/semantic-release/semantic-release )
5
6
[ ![ Renovate - Always up to date] [ renovateapp-svg ]] [ renovateapp-link ]
7
+ [ ![ Coverage Status] ( https://coveralls.io/repos/github/ultrox/pkginfo/badge.svg?branch=master )] ( https://coveralls.io/github/ultrox/pkginfo?branch=master )
8
+
9
+ Flexible api to fetch npm package info
6
10
7
11
[ renovateapp-link ] : https://renovatebot.com/dashboard#github/ultrox/pkginfo
8
12
[ renovateapp-svg ] : https://img.shields.io/badge/always-up_to_date-brightgreen.svg
9
13
10
14
## Install
11
15
12
-
13
16
#### NPM
17
+
14
18
` npm install @ma.vu/pkginfo `
15
19
16
20
#### YARN
17
- ` yarn add @ma.vu/pkginfo `
18
21
22
+ ` yarn add @ma.vu/pkginfo `
19
23
20
24
## Usage
21
25
@@ -38,7 +42,7 @@ pkginfo('got').then(data => console.log(data))
38
42
39
43
## Override Defaults
40
44
41
- You are able to specify what you get in output.
45
+ You are able to specify what you get in output.
42
46
43
47
NOTE: It will completely override defaults
44
48
@@ -57,7 +61,6 @@ devDependencies => Int
57
61
dependencies => Int
58
62
```
59
63
60
-
61
64
``` javascript
62
65
const pkginfo = require (' @ma.vu/pkginfo' )
63
66
@@ -77,8 +80,8 @@ info('got', [
77
80
devDependencies: 16
78
81
}
79
82
*/
80
-
81
83
```
84
+
82
85
### Require Exact version
83
86
84
87
It accepts object, and exact version of package you fetching, and now ` version `
@@ -111,7 +114,15 @@ Rationale for this is, if you query db and query can't yield the result, you
111
114
will get null, error will not be thrown. The same is for version
112
115
113
116
``` javascript
114
- info (' not-existing-package-name' ).then (data => console .log ())
117
+ info (' not-existing-package-name' ).then (data => console .log (data))
118
+ /*
119
+ null
120
+ */
121
+ ```
122
+
123
+ #### Version does not exists
124
+ ``` javascript
125
+ info ({name: ' react' , version: ' 100.0.0' }).then (data => console .log (data))
115
126
/*
116
127
null
117
128
*/
0 commit comments