package
Check if a token is a valid variable name
npm install is-valid-variableGitHub-flavored package documentation.
Across all versions, last 30 days.
2,641 in 30 days
Runtime metadata.
Estimated unpacked size across 1 packages.
3.9 kB
Includes dependencies.
Check if a token is a valid variable name
npm install is-valid-propertyDoesn'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
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')) // trueMIT