react-tree-svg
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -6,3 +6,3 @@ /** | ||
export function prepareTree(data, options) { | ||
data = JSON.parse(JSON.stringify(data)); | ||
data = structuredClone(data); | ||
prepareTreeSS(data, options); | ||
@@ -12,3 +12,3 @@ return data; | ||
function prepareTreeSS(data, options) { | ||
const { nodeRenderer, nodeRendererOptions = {} } = options; | ||
const { nodeRenderer, nodeRendererOptions = {}, shouldSkipBranch } = options; | ||
for (const datum of data) { | ||
@@ -30,2 +30,5 @@ if (options.level > 0) { | ||
if (datum.children) { | ||
if (shouldSkipBranch) { | ||
datum.children = datum.children.filter((child) => !shouldSkipBranch(child)); | ||
} | ||
prepareTreeSS(datum.children, { | ||
@@ -32,0 +35,0 @@ ...options, |
@@ -9,3 +9,3 @@ "use strict"; | ||
function prepareTree(data, options) { | ||
data = JSON.parse(JSON.stringify(data)); | ||
data = structuredClone(data); | ||
prepareTreeSS(data, options); | ||
@@ -15,3 +15,3 @@ return data; | ||
function prepareTreeSS(data, options) { | ||
const { nodeRenderer, nodeRendererOptions = {} } = options; | ||
const { nodeRenderer, nodeRendererOptions = {}, shouldSkipBranch } = options; | ||
for (const datum of data) { | ||
@@ -33,2 +33,5 @@ if (options.level > 0) { | ||
if (datum.children) { | ||
if (shouldSkipBranch) { | ||
datum.children = datum.children.filter((child) => !shouldSkipBranch(child)); | ||
} | ||
prepareTreeSS(datum.children, { | ||
@@ -35,0 +38,0 @@ ...options, |
{ | ||
"name": "react-tree-svg", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "module": "lib-esm/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132300
2050