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

obj-case

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

obj-case - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

2

component.json

@@ -5,3 +5,3 @@ {

"description": "Work with objects of different cased keys",
"version": "0.0.9",
"version": "0.0.10",
"keywords": [],

@@ -8,0 +8,0 @@ "dependencies": {

0.0.10 / 2014-08-30
===================
* Merge pull request #6 from segmentio/fix/shared-prefix
* adding more tests for an edge case we didnt consider
0.0.9 / 2014-08-30

@@ -3,0 +9,0 @@ ==================

@@ -68,23 +68,26 @@

if (0 === path.indexOf(normalizedKey)) {
path = path.substr(normalizedKey.length + 1);
var child = obj[key];
var temp = path.substr(normalizedKey.length);
if (temp.charAt(0) === '.' || temp.length === 0) {
path = temp.substr(1);
var child = obj[key];
// we're at the end and there is nothing.
if (null == child) {
finished = true;
obj = null;
return;
}
// we're at the end and there is nothing.
if (null == child) {
finished = true;
obj = null;
return;
}
// we're at the end and there is something.
if (!path.length) {
finished = true;
// we're at the end and there is something.
if (!path.length) {
finished = true;
return;
}
// step into child
obj = child;
// but we're done here
return;
}
// step into child
obj = child;
// but we're done here
return;
}

@@ -91,0 +94,0 @@ }

{
"name": "obj-case",
"version": "0.0.9",
"version": "0.0.10",
"description": "Work with objects of different cased keys",

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

@@ -43,2 +43,29 @@

it('should work with properties with same prefix', function () {
var obj3 = {
website: {
left: 'aaaa'
},
websites: {
right: 'bbbb'
}
};
expect(objCase(obj3, 'website.left')).to.eql('aaaa');
expect(objCase(obj3, 'websites.right')).to.eql('bbbb');
var obj1 = {
website: 'aaaa',
websites: 'bbbb'
};
expect(objCase(obj1, 'website')).to.eql('aaaa');
expect(objCase(obj1, 'websites')).to.eql('bbbb');
var obj2 = {
websites: 'bbbb',
website: 'aaaa'
};
expect(objCase(obj2, 'website')).to.eql('aaaa');
expect(objCase(obj2, 'websites')).to.eql('bbbb');
});
describe('casing', function(){

@@ -45,0 +72,0 @@ it('should find crazy looking paths', function () {

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