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

tree-flatter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-flatter - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

HISTORY.md

12

index.js
'use strict';
const _ = require('lodash');
/**

@@ -61,2 +63,4 @@ * Recursive node

const stack = [];
console.log(tree);
const _tree = _.cloneDeep(tree);
const settings = {

@@ -71,8 +75,8 @@ initNode: options.initNode || (node => node),

if (Array.isArray(tree) && tree.length) {
if (Array.isArray(_tree) && _tree.length) {
// Object Array
for (let i = 0, len = tree.length; i < len; i++) {
for (let i = 0, len = _tree.length; i < len; i++) {
stack.push(
flattenNodeGenerator(
tree[i],
_tree[i],
'root', // placeholder

@@ -87,3 +91,3 @@ i,

// One object tree
stack.push(flattenNodeGenerator(tree, 'root', 0, settings, stack));
stack.push(flattenNodeGenerator(_tree, 'root', 0, settings, stack));
}

@@ -90,0 +94,0 @@

{
"name": "tree-flatter",
"version": "1.0.1",
"version": "1.0.2",
"description": "Transforms a nested tree structure into a flat list, each item has it's children reference and parent reference.",

@@ -27,3 +27,6 @@ "main": "index.js",

"mocha": "^3.4.2"
},
"dependencies": {
"lodash": "^4.17.4"
}
}

@@ -76,3 +76,3 @@ 'use strict';

for (i = 0; i < 10000; i++) {
for (i = 0; i < 100; i++) {
node = generateChildren(node);

@@ -79,0 +79,0 @@

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