{"_id":"is-var-name","_rev":"7-48405619c076976995d4de830e729b16","name":"is-var-name","description":"Check if a string can be used as a JavaScript variable name","dist-tags":{"latest":"2.0.0","next":"2.0.0-0"},"versions":{"1.0.0":{"name":"is-var-name","version":"1.0.0","description":"Check if a string can be used as a JavaScript variable name","repository":{"type":"git","url":"https://github.com/shinnn/is-var-name"},"scripts":{"pretest":"eslint *.js & jscs *.js","test":"node test.js | tap-spec","coverage":"istanbul cover test.js","coveralls":"${npm_package_scripts_coverage} && istanbul-coveralls"},"licenses":[{"type":"MIT","url":"https://github.com/shinnn/is-var-name/blob/master/LICENSE"}],"main":"is-var-name-cjs.js","files":["is-var-name-cjs.js","LICENSE"],"keywords":["var","variable","check","character","javascript","cmascript","specification","validation","spec","string","browser","client-side"],"devDependencies":{"eslint":"^0.9.2","istanbul":"^0.3.2","istanbul-coveralls":"^1.0.1","jscs":"^1.7.3","require-bower-files":"^1.0.0","tap-spec":"^2.1.0","tape":"^3.0.3"},"jscsConfig":{"preset":"google","maximumLineLength":98},"gitHead":"b2923046b46793012f79e80e39c6f716ca45401c","bugs":{"url":"https://github.com/shinnn/is-var-name/issues"},"homepage":"https://github.com/shinnn/is-var-name","_id":"is-var-name@1.0.0","_shasum":"d3dbfe09b1ccc623100134029e7bd0af8cbb764d","_from":".","_npmVersion":"2.1.7","_nodeVersion":"0.10.33","_npmUser":{"name":"shinnn","email":"snnskwtnb@gmail.com"},"maintainers":[{"name":"shinnn","email":"snnskwtnb@gmail.com"}],"dist":{"shasum":"d3dbfe09b1ccc623100134029e7bd0af8cbb764d","tarball":"https://registry.npmjs.org/is-var-name/-/is-var-name-1.0.0.tgz","integrity":"sha512-QvOfvkJ+0srlNEepWBGeMi9EJryfsCo0M0q+cKj/hPmtLBQ2zEUiX4AQzILj4E0HXZ6P7Qpl8KZmydpWA5Un4Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGsB9rrhL1YPL4dpgAETmL1hNssOg15dsifC0ap5SQXMAiEA+OkrPh+n4oUs+YHV13W+/+Qr5Rm7QR7JEdU4r3vF2Os="}]},"directories":{}},"2.0.0-0":{"name":"is-var-name","version":"2.0.0-0","description":"Check if a string can be used as a JavaScript variable name","repository":{"type":"git","url":"git+https://github.com/shinnn/is-var-name.git"},"scripts":{"prebuild":"eslint --fix --format=codeframe index.mjs test.js","build":"rollup --config=node:module","pretest":"npm run-script build","test":"nyc --reporter=html --reporter=text node test.js"},"license":"ISC","files":["index.js","index.mjs"],"module":"index.mjs","keywords":["var","variable","let","const","identifier","check","character","javascript","ecmascript","specification","validation","spec","string"],"devDependencies":{"@shinnn/eslint-config":"^5.4.0","eslint":"^4.18.0","nyc":"^11.5.0","rollup":"^0.56.2","rollup-config-module":"^2.0.0","tape":"^4.9.0"},"eslintConfig":{"extends":"@shinnn","rules":{"no-new-func":"off"}},"readme":"# is-var-name\n\n[![npm version](https://img.shields.io/npm/v/is-var-name.svg)](https://www.npmjs.com/package/is-var-name)\n[![Build Status](https://travis-ci.org/shinnn/is-var-name.svg?branch=master)](https://travis-ci.org/shinnn/is-var-name)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/is-var-name.svg)](https://coveralls.io/r/shinnn/is-var-name)\n\nCheck if a string can be used as a [JavaScript variable name](http://es5.github.io/x7.html#x7.6)\n\n```javascript\nisVarName('foo'); //=> true\nisVarName('f o o'); //=> false\n```\n\n## Installation\n\n[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).\n\n```\nnpm install is-var-name\n```\n\n## API\n\n```javascript\nimport isVarName from 'is-var-name';\n```\n\n### isVarName(*name*)\n\n*name*: `string`  \nReturn: `boolean`\n\nIt returns `true` if [the string can be used as a valid JavaScript identifier name](https://mathiasbynens.be/notes/javascript-identifiers). If not, or the argument is not a string, it returns `false`.\n\n```javascript\nisVarName('______________'); //=> true\nisVarName('å'); //=> true\n\nisVarName('123'); //=> false\nisVarName('↑→↓←'); //=> false\n\nisVarName(['foo']); //=> false\nisVarName(); //=> false\n```\n\n## Another solution\n\nInstead of this module, you can use [the regular expression that matches valid variable names](http://stackoverflow.com/questions/1661197/valid-characters-for-javascript-variable-names/9337047#9337047).\n\n### Regular expression pros\n\n*is-var-name* uses [`Function` constructor](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function) but regular expression doesn't.\n\nAccording to [the ESLint documentation](http://eslint.org/docs/rules/no-new-func.html), `new Function()` is:\n\n> considered by many to be a bad practice due to the difficult in debugging and reading these types of functions.\n\n### Regular expression cons\n\nSince the regular expression is too long (11,236 characters), it increases the file size of your package/repository/website.\n\n## License\n\n[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe\n","readmeFilename":"README.md","gitHead":"fb55ccb57470fd07e8eca48eebd94b0073ad9224","bugs":{"url":"https://github.com/shinnn/is-var-name/issues"},"homepage":"https://github.com/shinnn/is-var-name#readme","_id":"is-var-name@2.0.0-0","_npmVersion":"5.6.0","_nodeVersion":"9.5.0","_npmUser":{"name":"shinnn","email":"snnskwtnb@gmail.com"},"dist":{"integrity":"sha512-Fn6H15rUUzX3tVxoKo1xbyO3AbPu1M+g5QBJtjIWIshFL8IJvI+9VW1/oB4BIbjmPT9WlIulAytpte9rBrFi/w==","shasum":"9ac4929f1bd13d1c869e83504a427906f4bd15a5","tarball":"https://registry.npmjs.org/is-var-name/-/is-var-name-2.0.0-0.tgz","fileCount":5,"unpackedSize":4362,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGLaOx8RWdah9hHlyIkS8pRjuFDLiI0WyF9lC55EhenaAiAMSjJv8v0bu00zLg70hm74gHJaz2x7ZUfSuJk1UVD67A=="}]},"maintainers":[{"name":"shinnn","email":"snnskwtnb@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-var-name_2.0.0-0_1519029336476_0.5823459022867732"},"_hasShrinkwrap":false},"2.0.0":{"name":"is-var-name","version":"2.0.0","description":"Check if a string can be used as a JavaScript variable name","repository":{"type":"git","url":"git+https://github.com/shinnn/is-var-name.git"},"scripts":{"prebuild":"eslint --fix --format=codeframe index.mjs test.js","build":"rollup --config=node:module","pretest":"npm run-script build","test":"nyc --reporter=html --reporter=text node test.js"},"license":"ISC","files":["index.js","index.mjs"],"module":"index.mjs","keywords":["var","variable","let","const","identifier","check","character","javascript","ecmascript","specification","validation","spec","string"],"devDependencies":{"@shinnn/eslint-config":"^5.4.0","eslint":"^4.18.0","nyc":"^11.5.0","rollup":"^0.56.2","rollup-config-module":"^2.0.0","tape":"^4.9.0"},"eslintConfig":{"extends":"@shinnn","rules":{"no-new-func":"off"}},"gitHead":"f84d226305ae3c0653b7d6b78b7059ccc901cb46","bugs":{"url":"https://github.com/shinnn/is-var-name/issues"},"homepage":"https://github.com/shinnn/is-var-name#readme","_id":"is-var-name@2.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.5.0","_npmUser":{"name":"shinnn","email":"snnskwtnb@gmail.com"},"dist":{"integrity":"sha512-U+7mpdfaV4Qz2hDNy1Vt7TjWwdIp6br/w7CUlTnyMdsJq+IOSZrh+RsJNlSSckPAnTllhWxpiqC7VSxVTbcr2Q==","shasum":"28cad24d1e4021640bc54668b2de84a9f9b0d776","tarball":"https://registry.npmjs.org/is-var-name/-/is-var-name-2.0.0.tgz","fileCount":5,"unpackedSize":4595,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEvBq2LQL95VZwKWHD34h8xHe7VUiyHqaZ7pA1X/lwBpAiAWt44j1j7ZZZnwi0AeWB82ER7nKA46VmgQ8w5C3muLjQ=="}]},"maintainers":[{"name":"shinnn","email":"snnskwtnb@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-var-name_2.0.0_1519032318230_0.6756913792495136"},"_hasShrinkwrap":false}},"readme":"# is-var-name\n\n[![npm version](https://img.shields.io/npm/v/is-var-name.svg)](https://www.npmjs.com/package/is-var-name)\n[![Build Status](https://travis-ci.org/shinnn/is-var-name.svg?branch=master)](https://travis-ci.org/shinnn/is-var-name)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/is-var-name.svg)](https://coveralls.io/r/shinnn/is-var-name)\n\nCheck if a string can be used as a [JavaScript variable name](https://es5.github.io/x7.html#x7.6)\n\n```javascript\nisVarName('foo'); //=> true\nisVarName('f o o'); //=> false\n```\n\n## Installation\n\n[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).\n\n```\nnpm install is-var-name\n```\n\n## API\n\n```javascript\nimport isVarName from 'is-var-name';\n```\n\n### isVarName(*name*)\n\n*name*: `string`  \nReturn: `boolean`\n\nIt returns `true` if [the string can be used as a valid JavaScript identifier name](https://mathiasbynens.be/notes/javascript-identifiers). If not, or the argument is not a string, it returns `false`.\n\n```javascript\nisVarName('______________'); //=> true\nisVarName('å'); //=> true\n\nisVarName('123'); //=> false\nisVarName('↑→↓←'); //=> false\nisVarName('_;'); //=> false\nisVarName(''); //=> false\n\nisVarName(['foo']); //=> false\nisVarName(); //=> false\n```\n\n## Another solution\n\nInstead of this module, you can use [the regular expression that matches valid variable names](https://gist.github.com/mathiasbynens/6334847#file-ecmascript-6-js).\n\n### Regular expression pros\n\n*is-var-name* uses [`Function` constructor](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function) but regular expression doesn't.\n\nAccording to [the ESLint documentation](https://eslint.org/docs/rules/no-new-func), `new Function()` is:\n\n> considered by many to be a bad practice due to the difficult in debugging and reading these types of functions.\n\n### Regular expression cons\n\nSince the regular expression is too long ([about 16,000 characters](https://gist.githubusercontent.com/mathiasbynens/6334847/raw/4b78d62a29da1f340956aa102dffa6c4ac7e620e/ecmascript-6.js)), it increases the file size of your library or application.\n\n## License\n\n[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe\n","maintainers":[{"name":"shinnn","email":"snnskwtnb@gmail.com"}],"time":{"modified":"2022-06-19T02:53:14.402Z","created":"2014-11-25T04:04:33.807Z","1.0.0":"2014-11-25T04:04:33.807Z","2.0.0-0":"2018-02-19T08:35:36.532Z","2.0.0":"2018-02-19T09:25:18.319Z"},"homepage":"https://github.com/shinnn/is-var-name#readme","keywords":["var","variable","let","const","identifier","check","character","javascript","ecmascript","specification","validation","spec","string"],"repository":{"type":"git","url":"git+https://github.com/shinnn/is-var-name.git"},"bugs":{"url":"https://github.com/shinnn/is-var-name/issues"},"readmeFilename":"README.md","license":"ISC"}