Add dependency
Some checks failed
/ build_android (push) Failing after 21s

This commit is contained in:
Pieter Vander Vennet 2025-06-18 18:50:46 +02:00
parent 55470c090d
commit 6947a1adba
1260 changed files with 111297 additions and 0 deletions

View file

@ -0,0 +1,185 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.1.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.5...@ionic/utils-array@2.1.6) (2023-03-29)
**Note:** Version bump only for package @ionic/utils-array
## [2.1.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.4...@ionic/utils-array@2.1.5) (2020-08-28)
**Note:** Version bump only for package @ionic/utils-array
## [2.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.3...@ionic/utils-array@2.1.4) (2020-08-25)
**Note:** Version bump only for package @ionic/utils-array
## [2.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.2...@ionic/utils-array@2.1.3) (2020-05-12)
### Bug Fixes
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
## [2.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.1...@ionic/utils-array@2.1.2) (2020-05-06)
**Note:** Version bump only for package @ionic/utils-array
## [2.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.1.0...@ionic/utils-array@2.1.1) (2020-03-03)
**Note:** Version bump only for package @ionic/utils-array
# 2.1.0 (2020-02-11)
### Features
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.0.1...@ionic/utils-array@2.0.2) (2020-02-10)
**Note:** Version bump only for package @ionic/utils-array
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@2.0.0...@ionic/utils-array@2.0.1) (2020-02-03)
**Note:** Version bump only for package @ionic/utils-array
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.2.2...@ionic/utils-array@2.0.0) (2020-01-25)
### chore
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
### BREAKING CHANGES
* A minimum of Node.js 10.3.0 is required.
## [1.2.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.2.1...@ionic/utils-array@1.2.2) (2019-12-05)
**Note:** Version bump only for package @ionic/utils-array
## [1.2.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.2.0...@ionic/utils-array@1.2.1) (2019-09-18)
**Note:** Version bump only for package @ionic/utils-array
# [1.2.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.1.1...@ionic/utils-array@1.2.0) (2019-08-28)
### Features
* **replace:** add replace item in array by index function ([011ddf7](https://github.com/ionic-team/ionic-cli/commit/011ddf7))
* **splice:** add non-mutating splice function ([758d287](https://github.com/ionic-team/ionic-cli/commit/758d287))
## [1.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.1.0...@ionic/utils-array@1.1.1) (2019-08-23)
**Note:** Version bump only for package @ionic/utils-array
# [1.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.0.2...@ionic/utils-array@1.1.0) (2019-08-14)
### Features
* add new `move` function ([ba8da3b](https://github.com/ionic-team/ionic-cli/commit/ba8da3b))
## [1.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.0.1...@ionic/utils-array@1.0.2) (2019-08-07)
**Note:** Version bump only for package @ionic/utils-array
## [1.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@1.0.0...@ionic/utils-array@1.0.1) (2019-06-05)
**Note:** Version bump only for package @ionic/utils-array
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-array@0.0.1...@ionic/utils-array@1.0.0) (2019-05-29)
### chore
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
### BREAKING CHANGES
* A minimum of Node.js 8.9.4 is required.
<a name="0.0.1"></a>
## 0.0.1 (2019-02-27)
**Note:** Version bump only for package @ionic/utils-array

View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017 Drifty Co
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1 @@
# @ionic/utils-array

View file

@ -0,0 +1,39 @@
export declare function conform<T>(t?: T | T[]): T[];
export declare function concurrentFilter<T>(array: T[], callback: (currentValue: T) => Promise<boolean>): Promise<T[]>;
export declare function filter<T>(array: T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<boolean>): Promise<T[]>;
export declare function filter<T>(array: readonly T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<boolean>): Promise<readonly T[]>;
export declare function map<T, U>(array: T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>): Promise<U[]>;
export declare function map<T, U>(array: T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>): Promise<readonly U[]>;
export declare function map<T, U>(array: readonly T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>): Promise<U[]>;
export declare function map<T, U>(array: readonly T[], callback: (currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>): Promise<readonly U[]>;
export declare function reduce<T>(array: T[], callback: (accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<T>): Promise<T>;
export declare function reduce<T>(array: T[], callback: (accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<T>, initialValue: T): Promise<T>;
export declare function reduce<T, R>(array: T[], callback: (accumulator: R, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<R>): Promise<R>;
export declare function reduce<T, U>(array: T[], callback: (accumulator: U, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>, initialValue: U): Promise<U>;
export declare function reduce<T>(array: readonly T[], callback: (accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<T>): Promise<T>;
export declare function reduce<T>(array: readonly T[], callback: (accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<T>, initialValue: T): Promise<T>;
export declare function reduce<T, R>(array: readonly T[], callback: (accumulator: R, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<R>): Promise<R>;
export declare function reduce<T, U>(array: readonly T[], callback: (accumulator: U, currentValue: T, currentIndex: number, array: readonly T[]) => Promise<U>, initialValue: U): Promise<U>;
/**
* Splice an array.
*
* This function will return a new array with the standard splice behavior
* applied. Unlike the standard array splice, the array of removed items is not
* returned.
*/
export declare function splice<T>(array: readonly T[], start: number, deleteCount?: number, ...items: T[]): T[];
/**
* Move an item in an array by index.
*
* This function will return a new array with the item in the `fromIndex`
* position moved to the `toIndex` position. If `fromIndex` or `toIndex` are
* out of bounds, the array items remain unmoved.
*/
export declare function move<T>(array: readonly T[], fromIndex: number, toIndex: number): T[];
/**
* Replace an item in an array by index.
*
* This function will return a new array with the item in the `index` position
* replaced with `item`. If `index` is out of bounds, the item is not replaced.
*/
export declare function replace<T>(array: readonly T[], index: number, item: T): T[];

View file

@ -0,0 +1,97 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.replace = exports.move = exports.splice = exports.reduce = exports.map = exports.filter = exports.concurrentFilter = exports.conform = void 0;
function conform(t) {
if (typeof t === 'undefined') {
return [];
}
if (!Array.isArray(t)) {
return [t];
}
return t;
}
exports.conform = conform;
async function concurrentFilter(array, callback) {
const mapper = async (v) => [v, await callback(v)];
const mapped = await Promise.all(array.map(mapper));
return mapped
.filter(([, f]) => f)
.map(([v]) => v);
}
exports.concurrentFilter = concurrentFilter;
async function filter(array, callback) {
const initial = [];
return reduce(array, async (acc, v, i, arr) => {
if (await callback(v, i, arr)) {
acc.push(v);
}
return acc;
}, initial);
}
exports.filter = filter;
async function map(array, callback) {
const initial = [];
return reduce(array, async (acc, v, i, arr) => {
acc.push(await callback(v, i, arr));
return acc;
}, initial);
}
exports.map = map;
async function reduce(array, callback, initialValue) {
const hadInitialValue = typeof initialValue === 'undefined';
const startingIndex = hadInitialValue ? 1 : 0;
if (typeof initialValue === 'undefined') {
if (array.length === 0) {
throw new TypeError('Reduce of empty array with no initial value');
}
initialValue = array[0];
}
let value = initialValue;
for (let i = startingIndex; i < array.length; i++) {
const v = await callback(value, array[i], i, array);
value = v;
}
return value;
}
exports.reduce = reduce;
/**
* Splice an array.
*
* This function will return a new array with the standard splice behavior
* applied. Unlike the standard array splice, the array of removed items is not
* returned.
*/
function splice(array, start, deleteCount = array.length - start, ...items) {
const result = [...array];
result.splice(start, deleteCount, ...items);
return result;
}
exports.splice = splice;
/**
* Move an item in an array by index.
*
* This function will return a new array with the item in the `fromIndex`
* position moved to the `toIndex` position. If `fromIndex` or `toIndex` are
* out of bounds, the array items remain unmoved.
*/
function move(array, fromIndex, toIndex) {
const element = array[fromIndex];
if (fromIndex < 0 || toIndex < 0 || fromIndex >= array.length || toIndex >= array.length) {
return [...array];
}
return splice(splice(array, fromIndex, 1), toIndex, 0, element);
}
exports.move = move;
/**
* Replace an item in an array by index.
*
* This function will return a new array with the item in the `index` position
* replaced with `item`. If `index` is out of bounds, the item is not replaced.
*/
function replace(array, index, item) {
if (index < 0 || index > array.length) {
return [...array];
}
return splice(array, index, 1, item);
}
exports.replace = replace;

View file

@ -0,0 +1,49 @@
{
"name": "@ionic/utils-array",
"version": "2.1.6",
"description": "Array utils",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"homepage": "https://ionicframework.com/",
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
"license": "MIT",
"engines": {
"node": ">=16.0.0"
},
"files": [
"dist/",
"LICENSE",
"README.md"
],
"repository": {
"type": "git",
"url": "https://github.com/ionic-team/ionic-cli.git"
},
"bugs": {
"url": "https://github.com/ionic-team/ionic-cli/issues"
},
"scripts": {
"clean": "rimraf dist",
"lint": "true",
"build": "npm run clean && tsc",
"watch": "tsc -w --preserveWatchOutput",
"test": "jest --maxWorkers=4",
"prepublishOnly": "npm run build"
},
"dependencies": {
"debug": "^4.0.0",
"tslib": "^2.0.1"
},
"devDependencies": {
"@types/debug": "^4.1.1",
"@types/jest": "^26.0.10",
"@types/node": "~16.0.0",
"jest": "^26.4.2",
"jest-cli": "^26.0.1",
"lint-staged": "^10.0.2",
"rimraf": "^3.0.0",
"ts-jest": "~26.3.0",
"typescript": "~4.8.0"
},
"gitHead": "15ef6e7da4eace4fd55d16fd9508d156a4bc8203"
}