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

node-json-transform

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-json-transform - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

8

index.js

@@ -71,2 +71,10 @@ // DataTransform

obj[newkey] = this.getValue(item, oldkey);
} else if( _.isArray(oldkey) ) {
var array = [];
_.each(oldkey, _.bind(function(key){
array.push(this.getValue(item, key));
},this));
obj[newkey] = array;
} else {

@@ -73,0 +81,0 @@ obj[newkey] = "";

2

package.json
{
"name": "node-json-transform",
"version": "1.0.3",
"version": "1.0.4",
"description": "A node module for transforming and performing operations on JSON.",

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

@@ -50,3 +50,4 @@ # node-data-transform

item: "list1.0.name",
clearMe: ""
clearMe: "",
fieldGroup: ['title', 'extra']
},

@@ -79,3 +80,4 @@ operate: [

info: "mike",
clearMe: ""
clearMe: "",
fieldGroup: ['title1', { link : "http://goo.cm" }]
}]

@@ -88,2 +90,3 @@ ```

1.0.4 Added the ability to group fields into arrays
1.0.3 Added the ability to clear and set field by passing an empty string in the map.

@@ -90,0 +93,0 @@

@@ -111,2 +111,27 @@ var DataTransform = require('../index.js').DataTransform,

it("should allow you to map arrays", function(){
// Add a map item to clear out the "clearMe" field.
var newMap = {
list : 'posts',
item: {
fieldGroup: ["title", "description", "blog", "extra"]
}
};
var dataTransform = DataTransform(data, newMap);
expect(dataTransform.transform()).toEqual([{
fieldGroup : [
"title1",
"description1",
"This is a blog.",
{
link : "http://goo.cm"
}
]
}]);
});
});
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