safe-identifier
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -25,3 +25,3 @@ const { reservedES3, reservedESnext } = require('./reserved') | ||
function identifier(key, unique) { | ||
if (unique) key += ' ' + hashCode(key) | ||
if (unique) key += ' ' + hashCode(key).toString(36) | ||
const id = key.trim().replace(/\W+/g, '_') | ||
@@ -28,0 +28,0 @@ return reservedES3[id] || reservedESnext[id] || /^\d/.test(id) ? '_' + id : id |
{ | ||
"name": "safe-identifier", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"author": "Eemeli Aro <eemeli@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
@@ -14,3 +14,4 @@ # safe-identifier | ||
identifier('enum') === '_enum' | ||
identifier(' my \0var ') === 'my_var' | ||
identifier('my var', true) === 'my_var_hk17pp' | ||
identifier(' my \0var ', true) === 'my_var_1d8fi3' | ||
@@ -17,0 +18,0 @@ property('Foo', 'bar') === 'Foo.bar' |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7559
43