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

parse-strings-in-object

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-strings-in-object - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

4

package.json
{
"name": "parse-strings-in-object",
"version": "1.1.0",
"version": "1.1.1",
"description": "Convert string values in object to boolean and numbers",

@@ -8,3 +8,3 @@ "repository": "https://github.com/anselanza/parse-strings-in-object",

"scripts": {
"test": "npx mocha test/tests.js"
"test": "npx mocha test/tests.js --watch"
},

@@ -11,0 +11,0 @@ "author": "Stephen Buchanan",

@@ -58,49 +58,53 @@ const expect = require('chai').expect;

// it ('should parse a nested structure properly', () => {
// const before = {
// topLevel: true,
// topNumber: 1,
// foo: {
// active: 'true',
// number: '0',
// anotherNumber: '3.17',
// },
// bar: {
// active: 'false',
// number: '10',
// aString: 'yo',
// subSub: {
// thisIsTrue: 'true',
// thisIsFalse: 'false',
// thisIsNumber: '0.00006'
// }
// },
// justAString: 'hello',
// ipAddress: '192.168.1.101'
// }
// const result = parser(before);
// const expected = {
// topLevel: true,
// topNumber: 1,
// foo: {
// active: true,
// number: 0,
// anotherNumber: 3.17,
// },
// bar: {
// active: false,
// number: 10,
// aString: 'yo',
// subSub: {
// thisIsTrue: true,
// thisIsFalse: false,
// thisIsNumber: 0.00006
// }
// },
// justAString: 'hello',
// ipAddress: '192.168.1.101'
// }
// expect(result).to.equal(expected);
// });
it ('should parse a nested structure properly', () => {
const before = {
topLevel: true,
topNumber: 1,
foo: {
active: 'true',
number: '0',
anotherNumber: '3.17',
},
bar: {
active: 'false',
number: '10',
aString: 'yo',
subSub: {
thisIsTrue: 'true',
thisIsFalse: 'false',
thisIsNumber: '0.00006'
}
},
justAString: 'hello',
ipAddress: '192.168.1.101'
}
const result = parser(before);
const expected = {
topLevel: true,
topNumber: 1,
foo: {
active: true,
number: 0,
anotherNumber: 3.17,
},
bar: {
active: false,
number: 10,
aString: 'yo',
subSub: {
thisIsTrue: true,
thisIsFalse: false,
thisIsNumber: 0.00006
}
},
justAString: 'hello',
ipAddress: '192.168.1.101'
}
expect(result).to.deep.equal(expected);
expect(result.topLevel).to.equal(true);
expect(result.foo.active).to.equal(true);
expect(result.ipAddress).to.equal('192.168.1.101');
expect(result.bar.subSub.thisIsFalse).to.equal(false);
expect(result.bar.subSub.thisIsNumber).to.equal(0.00006);
});
});
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