convert-to-ecmascript-compatible-varname
Advanced tools
+6
-1
@@ -39,4 +39,9 @@ /** | ||
| // One last check to make sure we ended up with a valid variable name: | ||
| // (i.e. don't clash with special JavaScript keywords, like "delete") | ||
| if (!str.match(X_VALID_ECMA51_VARNAME)) { | ||
| throw new Error(util.format('The string "%s" cannot be converted into an ECMAScript 5.1-compatible variable name.', original)); | ||
| throw (function (){ | ||
| var e = new Error(util.format('The string "%s" cannot be converted into an ECMAScript 5.1-compatible variable name. "%s" collides with a JavaScript reserved word.', original)); | ||
| e.code = 'RESERVED'; | ||
| return e; | ||
| })(); | ||
| } | ||
@@ -43,0 +48,0 @@ |
+1
-1
| { | ||
| "name": "convert-to-ecmascript-compatible-varname", | ||
| "version": "0.1.1", | ||
| "version": "0.1.2", | ||
| "description": "Given a string of dash-delimited words, return a similar version of the string, but which is camel-cased and otherwise stripped of special characters, whitespace, etc. so that it is usable as an ECMAScript variable.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
21155
0.96%129
4.03%1
Infinity%