@ultraq/array-utils
Advanced tools
| export const __esModule: boolean; | ||
| /** | ||
| * <T> | ||
| */ | ||
| export type Predicate<T> = (item: T) => boolean; | ||
| /** | ||
| * Flattens an array of arrays of infinite depth into a single-dimension array. | ||
| * | ||
| * > This method is deprecated as it is now natively in JavaScript as the `flat` | ||
| * > method on an Array instance: | ||
| * > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat | ||
| * | ||
| * @deprecated Can be replaced with `array.flat(Infinity)` | ||
| * @param {Array<any>} array | ||
| * @return {Array<any>} Flattened array. | ||
| */ | ||
| export function flatten(array: Array<any>): Array<any>; | ||
| /** | ||
| * Creates an array of numbers from the starting value (inclusive) to the end | ||
| * (exclusive), with an optional step (the gap between values). | ||
| * | ||
| * @param {Number} start | ||
| * The value to start at, the first item in the returned array. | ||
| * @param {Number} end | ||
| * The value to end with, the last item in the returned array. | ||
| * @param {Number} [step=1] | ||
| * The increment/gap between values, defaults to 1. | ||
| * @return {number[]} An array encompassing the given range. | ||
| */ | ||
| export function range(start: number, end: number, step?: number): number[]; | ||
| /** | ||
| * A function to execute on each item in an array, returning truthy | ||
| * if the item passes whatever test is required for the use of this | ||
| * predicate. | ||
| * | ||
| * @template T | ||
| * @callback Predicate<T> | ||
| * @param {T} item | ||
| * @return {boolean} | ||
| */ | ||
| /** | ||
| * Remove and return the first item from `array` that matches the predicate | ||
| * function. | ||
| * | ||
| * @template T | ||
| * @param {T[]} array | ||
| * @param {Predicate<T>} predicate | ||
| * Function to test each item of the array with. If it returns a truthy value | ||
| * for the item, then that item is removed and returned. | ||
| * @return {T | undefined} The matching item, or `undefined` if no match was found. | ||
| */ | ||
| export function remove<T>(array: T[], predicate: Predicate<T>): T; |
+4
-0
@@ -5,2 +5,6 @@ | ||
| ### 3.1.1 | ||
| - Fix [Masquerading as ESM](https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseESM.md) | ||
| issue with the new package layout | ||
| ### 3.1.0 | ||
@@ -7,0 +11,0 @@ - Migrating to pure ESM for the next major version, the following internal |
+11
-5
| { | ||
| "name": "@ultraq/array-utils", | ||
| "version": "3.1.0", | ||
| "version": "3.1.1", | ||
| "description": "A collection of utilities for JavaScript arrays", | ||
@@ -23,5 +23,10 @@ "author": "Emanuel Rabina <emanuelrabina@gmail.com> (http://www.ultraq.net.nz/)", | ||
| "exports": { | ||
| "import": "./array-utils.js", | ||
| "require": "./array-utils.cjs", | ||
| "types": "./array-utils.d.ts" | ||
| "import": { | ||
| "default": "./array-utils.js", | ||
| "types": "./array-utils.d.ts" | ||
| }, | ||
| "require": { | ||
| "default": "./array-utils.cjs", | ||
| "types": "./array-utils.d.cts" | ||
| } | ||
| }, | ||
@@ -32,2 +37,3 @@ "files": [ | ||
| "array-utils.d.ts", | ||
| "array-utils.d.cts", | ||
| "CHANGELOG.md" | ||
@@ -41,3 +47,3 @@ ], | ||
| "build:cjs": "babel array-utils.js --out-file array-utils.cjs", | ||
| "build:dts": "tsc --allowJs --declaration --emitDeclarationOnly array-utils.js", | ||
| "build:dts": "tsc --allowJs --declaration --emitDeclarationOnly array-utils.js array-utils.cjs", | ||
| "prepublishOnly": "npm run build" | ||
@@ -44,0 +50,0 @@ }, |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24808
9.43%8
14.29%0
-100%