npm.io
1.0.1 • Published 3 years ago

is-valid-variable

Licence
MIT
Version
1.0.1
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
2

is-valid-variable

Check if a token is a valid variable name

npm install is-valid-property

Doesn't try to follow the full spec, ie might say false when something should be true, but will never say true when something should be false

Usage

const isValidVariable = require('is-valid-variable')

console.log(isValidVariable('const')) // false
console.log(isValidVariable('constantin')) // true
console.log(isValidVariable('64')) // false
console.log(isValidVariable('x64')) // true

License

MIT