1 | var valid = require("./")
|
2 |
|
3 | validate("some-package") // => {valid: true}
|
4 | validate("example.com") // => {valid: true}
|
5 | validate("CAPITALS") // => {valid: true}
|
6 | validate("under_score") // => {valid: true}
|
7 | validate("123numeric") // => {valid: true}
|
8 | validate("crazy!") // => {valid: true}
|
9 | validate("@npm/thingy") // => {valid: true}
|
10 | validate("@jane/foo.js") // => {valid: true}
|
11 |
|
12 | validate("") // => {valid: false, errors:["name length must be greater than zero"]}
|
13 | validate("ca$h") // => {valid: false, errors:["name can only contain URL-friendly characters"]}
|
14 | validate("_flodash") // => {valid: false, errors:["name cannot start with an underscore"]}
|