npm-valid
v1.3.1
Published
check if a package'name is valide & exist on npm
Downloads
2
Readme
npm-valid
check if a packages'name is valide & to publish on npm
Install
npm install npm-valid --save-dev
Usage
const isvalid = require("npm-valid");
isvalid("your-package-name").isvalid; //return true
isvalid("first_package").isvalid; //return true
isvalid("@first/package").isvalid; //return true
isvalid("js_snippets", { strict: true }).isvalid; //return false
also you will get object return like this
{
isvalid: false,
errors: ["os is a core module in node !"],
rules: [],
tips: ["name can't be the same name as a core Node module"]
}
cli
$ npm-valid --help
Usage
$ npm-valid <name> …
Options
--strict, -s strict validation for name
--error, -e display error if <name> not valide
--tips, -t display tips if <name> not valide
--rules, -r display rules if <name> not valide
Examples
$ npm-valid check-it
√ check-it is valid
$ npm-valid _request
× _request is not valid !
$ npm-valid os -s -e
× os not valid !
× os is a core module in node !
API
npmvalid([name], options)
name
Type: string
given name.
options
Type: object
given strict option true or false .
License
MIT © abdelhak akermi