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

xcase

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xcase - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

foo.js

9

index.js
'use strict';
let xcase = require('./build/Release/xcase');
function shouldProcessValue(value) {
return value && typeof value == 'object' &&
!(value instanceof Date) && !(value instanceof Function);
}
function processKeys(obj, fun, opts) {

@@ -18,3 +23,3 @@ let obj2;

key = fun(key, opts);
if(value && typeof value == 'object') {
if(shouldProcessValue(value)) {
obj2[key] = processKeys(value, fun, opts);

@@ -35,3 +40,3 @@ } else {

}
if(value && typeof value == 'object') {
if(shouldProcessValue(value)) {
obj[newKey] = processKeys(value, fun, opts);

@@ -38,0 +43,0 @@ } else {

{
"name": "xcase",
"version": "1.0.0",
"version": "1.0.1",
"description": "Blazingly fast recursive convertion to and from camelCase or PascalCase for Objects and Arrays",

@@ -5,0 +5,0 @@ "main": "index",

@@ -6,20 +6,2 @@ 'use strict';

function camelizeKeys(obj) {
let obj2 = obj instanceof Array ? [] : {};
let keys = Object.keys(obj);
for(var key of keys) {
let value = obj[key];
key = xcase.camelize(key);
if(value && typeof value == 'object') {
obj2[key] = camelizeKeys(value);
} else {
obj2[key] = value;
}
}
return obj2;
}
humps.camelizeKeys = camelizeKeys;
describe('passes humps tests', function() {

@@ -280,1 +262,11 @@ 'use strict';

});
describe('passes own tests', function() {
it('leaves Date/Function untouched', function() {
let date = new Date();
let obj = humps.decamelizeKeys({
fooBar: date
});
assert.equal(obj.foo_bar, date);
});
});
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