Comparing version 0.0.1 to 0.0.2
function camelifyString(str) { | ||
return str.replace(/\-([a-z]{1})/g, function (a, s) { return s.toUpperCase(); }, 'g'); | ||
return str.replace(/\-([a-z0-9]{1})/g, function (a, s) { return s.toUpperCase(); }, 'g'); | ||
} | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "camelify", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Simple util for mapping an object with hyphen-separated keys to camelCased keys", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -27,2 +27,13 @@ var camelify = require('../index'); | ||
it('can handle object keys with numbers', function () { | ||
var input = { | ||
'address-line-1': 1, | ||
'address-line-2-1': 2 | ||
}; | ||
camelify(input).should.eql({ | ||
addressLine1: 1, | ||
addressLine21: 2 | ||
}); | ||
}); | ||
it('returns a camelified string if passed a string', function () { | ||
@@ -29,0 +40,0 @@ camelify('hyphen-separated').should.equal('hyphenSeparated'); |
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
4100
59