Comparing version 0.0.33 to 0.0.34
@@ -257,7 +257,5 @@ "use strict"; | ||
// Children will not be an array if single item | ||
const forgoChildren = (Array.isArray(forgoChildrenObj) | ||
const forgoChildren = flatten((Array.isArray(forgoChildrenObj) | ||
? forgoChildrenObj | ||
: [forgoChildrenObj]) | ||
.filter((x) => typeof x !== "undefined" && x !== null) | ||
.flat(); | ||
: [forgoChildrenObj]).filter((x) => typeof x !== "undefined" && x !== null)); | ||
let forgoChildIndex = 0; | ||
@@ -532,2 +530,13 @@ if (forgoChildren) { | ||
exports.rerender = rerender; | ||
function flatten(array, ret = []) { | ||
for (const entry of array) { | ||
if (Array.isArray(entry)) { | ||
flatten(entry, ret); | ||
} | ||
else { | ||
ret.push(entry); | ||
} | ||
} | ||
return ret; | ||
} | ||
/* | ||
@@ -534,0 +543,0 @@ ForgoNodes can be primitive types. |
{ | ||
"name": "forgo", | ||
"version": "0.0.33", | ||
"version": "0.0.34", | ||
"main": "./dist", | ||
@@ -5,0 +5,0 @@ "author": "Jeswin Kumar<jeswinpk@agilehead.com>", |
@@ -539,8 +539,8 @@ declare global { | ||
// Children will not be an array if single item | ||
const forgoChildren = (Array.isArray(forgoChildrenObj) | ||
? forgoChildrenObj | ||
: [forgoChildrenObj] | ||
) | ||
.filter((x) => typeof x !== "undefined" && x !== null) | ||
.flat(); | ||
const forgoChildren = flatten( | ||
(Array.isArray(forgoChildrenObj) | ||
? forgoChildrenObj | ||
: [forgoChildrenObj] | ||
).filter((x) => typeof x !== "undefined" && x !== null) | ||
); | ||
@@ -919,2 +919,13 @@ let forgoChildIndex = 0; | ||
function flatten<T>(array: (T | T[])[], ret: T[] = []): T[] { | ||
for (const entry of array) { | ||
if (Array.isArray(entry)) { | ||
flatten(entry, ret); | ||
} else { | ||
ret.push(entry); | ||
} | ||
} | ||
return ret; | ||
} | ||
/* | ||
@@ -921,0 +932,0 @@ ForgoNodes can be primitive types. |
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
89310
1550