parse-strings-in-object
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"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); | ||
}); | ||
}); |
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
6786
160