UNPKG

1.28 kBMarkdownView Raw
1# validate-npm-package-name
2
3Give me a string and I'll tell you if it's a valid npm package name
4
5## Installation
6
7Download node at [nodejs.org](http://nodejs.org) and install it, if you haven't already.
8
9```sh
10npm install validate-npm-package-name --save
11```
12
13## Usage
14
15```js
16var valid = require("validate-npm-package-name")
17
18validate("some-package") // => {valid: true}
19validate("example.com") // => {valid: true}
20validate("CAPITALS") // => {valid: true}
21validate("under_score") // => {valid: true}
22validate("123numeric") // => {valid: true}
23validate("crazy!") // => {valid: true}
24validate("@npm/thingy") // => {valid: true}
25validate("@jane/foo.js") // => {valid: true}
26
27validate("") // => {valid: false, errors:["name length must be greater than zero"]}
28validate("ca$h") // => {valid: false, errors:["name can only contain URL-friendly characters"]}
29validate("_flodash") // => {valid: false, errors:["name cannot start with an underscore"]}
30
31```
32
33## Tests
34
35```sh
36npm install
37npm test
38```
39
40## Dependencies
41
42None
43
44## Dev Dependencies
45
46- [tap](https://github.com/isaacs/node-tap): A Test-Anything-Protocol library
47
48
49## License
50
51ISC
52
53_Generated by [package-json-to-readme](https://github.com/zeke/package-json-to-readme)_