ahwa
v0.1.2
Published
One tiny helper tool
Maintainers
Readme
ahwa
One tiny helper tool, written in typescript.
To install dependencies:
Install
npm install ahwaAll functions
| Function Name | Parameter Types | Return Types | Function Description | | --- | --- | --- | --- | | roundToDecimal | (num: number, digit: number) | number | Rounds a number to a specified number of decimal places | | sumArray | (nums: unknown[]) | number | null | Sums an array of numbers, considering decimal places | | multiplyArray | (nums: unknown[]) | number | null | Multiplies an array of numbers, considering decimal places | | pickProps | (obj: Record<PropertyKey, unknown>, keys: keyof T[]) | Pick<T, K> | Picks specified properties from an object | | omitProps | (obj: Record<PropertyKey, unknown>, keys: keyof T[]) | Omit<T, K> | Omits specified properties from an object | | checkType | (val: unknown, type: string) | boolean | Checks the type of a value | | isUndefined | (val: unknown) | val is undefined | Checks if a value is undefined | | isNull | (val: unknown) | val is null | Checks if a value is null | | isNullOrUndefined | (val: unknown) | val is null | undefined | Checks if a value is null or undefined | | isNumber | (val: unknown) | val is number | Checks if a value is a number | | isString | (val: unknown) | val is string | Checks if a value is a string | | isBoolean | (val: unknown) | val is boolean | Checks if a value is a boolean | | isObject | (val: unknown) | val is Record<PropertyKey, unknown> | Checks if a value is an object | | isSymbol | (val: unknown) | val is symbol | Checks if a value is a symbol | | isSet | (val: unknown) | val is Set | Checks if a value is a set | | isWeakSet | (val: unknown) | val is WeakSet | Checks if a value is a weak set | | isMap | (val: unknown) | val is Map<unknown, unknown> | Checks if a value is a map | | isWeakMap | (val: unknown) | val is WeakMap<object, unknown> | Checks if a value is a weak map | | isArray | (val: unknown) | val is unknown[] | Checks if a value is an array | | isFunction | (val: unknown) | val is () => unknown | Checks if a value is a function | | isDate | (val: unknown) | val is Date | Checks if a value is a date | | isEmpty | (val: unknown) | val is null | undefined | '' | Checks if a value is empty | | isStrictEmpty | (val: unknown) | val is null | undefined | unknown[] | string | Checks if a value is strictly empty | | isPromise | (val: unknown) | val is Promise | Checks if a value is a promise | | isAsyncFunction | (val: unknown) | val is Promise | Checks if a value is an async function | | checkObjectsEqual | (obj1: Record<PropertyKey, unknown>, obj2: Record<PropertyKey, unknown>) | boolean | Checks if two objects are equal | | checkArraysEqual | (arr1: unknown[], arr2: unknown[]) | boolean | Checks if two arrays are equal | | isEqual | (value1: unknown, value2: unknown) | boolean | Checks if two values are equal | | limitConcurrency | (fns: (() => Promise)[] = [], limit: number) | Promise<PromiseSettledResult[]> | Limits the concurrency of executing tasks | | flattenTree | (tree: T[] = [], props?: { childrenKey?: C; isDepthFirst?: boolean }) | T[] | Flattens a tree structure into an array | | buildTree | (list: T[], props?: { parentId?: K; id?: K; childrenKey?: C; judgeParentIdFn?: (item: T) => boolean }) | TreeNode<T, C>[] | Builds a tree structure from an array | | uniqueArray | (arr: T[], prop: K) | T[] | Removes duplicate objects from an array |
