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

restruct-data

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restruct-data - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "restruct-data",
"version": "0.2.0",
"version": "0.2.1",
"description": "ERROR: No README data found!",

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

@@ -16,7 +16,8 @@

}
restruct.flattenTrigger = '.array';
restruct.prototype.flatten = function (result, parent, key) {
// Go through entire result and flatten dicts that contain the
// '.array' command. If not true just remove command.
var flatten = result['.array'];
delete result['.array'];
// Go through entire result and flatten dicts that contain
// this.flattenTrigger command. If not true just remove command.
var flatten = result[restruct.flattenTrigger];
delete result[restruct.flattenTrigger];
if (flatten === true)

@@ -38,3 +39,3 @@ parent[key] = result = Object.keys(result).map(function (k) {

for (var key in struct) {
if (key === '.array') {
if (key === restruct.flattenTrigger) {
result[key] = struct[key];

@@ -41,0 +42,0 @@ continue;

@@ -85,4 +85,17 @@

}
var data = restruct(result, struct);
console.log(json(data,true))
restruct.flattenTrigger = '__array__';
var struct = {
"genders": {
"__array__": true,
"< gender": {
"__array__": true,
0: "= this.age > 25",
1: "{first}"
}
}
}
var data = restruct(result, struct);
console.log(json(data,true))
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