Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

camelify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

camelify - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

index.js
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');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc