UNPKG

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