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