Socket
Socket
Sign inDemoInstall

dottie

Package Overview
Dependencies
0
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

13

dottie.js

@@ -92,4 +92,13 @@ (function(undefined) {

// Transform unnested object with .-seperated keys into a nested object.
Dottie.transform = function(object) {
var pieces, piecesLength, current, transformed = {}, piece;
Dottie.transform = function(object, options) {
if (Array.isArray(object)) {
return object.map(Dottie.transform);
}
var pieces,
piecesLength,
piece,
current,
transformed = {};
for (var key in object) {

@@ -96,0 +105,0 @@ if (key.indexOf('.') !== -1) {

2

package.json
{
"name": "dottie",
"version": "0.2.1",
"version": "0.2.2",
"devDependencies": {

@@ -5,0 +5,0 @@ "expect.js": "~0.2.0",

@@ -103,2 +103,21 @@ var expect = require("expect.js"),

});
it("supports arrays", function () {
var values = [
{
'customer.name': 'John Doe',
'customer.age': 15,
'client': 'Lolcat'
},
{
'client.name': 'John Doe',
'client.age': 15,
'customer': 'Lolcat'
}
];
var transformed = dottie.transform(values);
expect(transformed[0].customer.name).to.equal('John Doe');
expect(transformed[1].client.name).to.equal('John Doe');
});
});
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc