commonly-used-utils
Advanced tools
Comparing version 1.0.0-beat8 to 1.0.0-beat9
{ | ||
"name": "commonly-used-utils", | ||
"version": "1.0.0-beat8", | ||
"version": "1.0.0-beat9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import { isObject, type } from './utils/basics' | ||
export const oneDimensional = ( | ||
export const oneDimensional: (array?: any[], children?: string | 'children') => (any[]) = ( | ||
array: any[] = [], | ||
children = 'children' | ||
) => { | ||
if (!array || !array.length) { | ||
return [] | ||
} | ||
if (!array || !array.length) { return [] } | ||
return array.reduce( | ||
@@ -11,0 +9,0 @@ (total, item) => total.concat(item, item?.[children]?.length ? oneDimensional(item[children], children): []), |
@@ -10,3 +10,3 @@ | ||
children?: 'children' | string | ||
): any[] | void | ||
): any[] | ||
export function TreeFindParents ( | ||
@@ -30,3 +30,3 @@ array: any[], | ||
export function removeItem(...param) | ||
export function sleep(time?: number) | ||
export function sleep(time?: number): void | ||
@@ -37,2 +37,5 @@ export class NotRepeatedArray { | ||
removeItem(...param) | ||
} | ||
} | ||
export function setTreeAttr(array, callback, children?: 'children' | string) | ||
export function deleteRecursively(array, callback, children?: 'children' | string) |
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
16186