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.10 to 0.3.0

2

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

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

@@ -62,5 +62,15 @@

var spot = result;
var k = fill(key, data);
if (k === undefined || k === null)
continue;
else if (Array.isArray(k)) {
for (var i=0; i < k.length-1; i++) {
var tk = k[i];
if (result[tk] === undefined)
result[tk] = {};
result = result[tk];
}
var k = k[i];
}

@@ -105,2 +115,6 @@ if (result[k] === undefined) {

delete result[k];
// If result was relocated by a dynamic key, spot will put it
// back in the original location.
result = spot;
}

@@ -107,0 +121,0 @@

@@ -169,1 +169,34 @@

console.log(json(data,true))
var result = [{
order: "1",
title: "Introduction",
text: "Welcome to the intro!",
}, {
order: "1.1",
title: "sub section",
text: "...text",
}, {
order: "1.1.1",
title: "sub sub section",
text: "......text",
}, {
order: "2",
title: "section",
text: "text",
}, {
order: "2.1",
title: "sub section",
text: "...text",
}];
var data = restruct(result, {
"children": {
"= this.order.split('.')": {
"title": true,
"text": true
},
"titles": [ "< title" ]
}
});
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