@nu-art/ts-common 0.202.71 → 0.202.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/utils/array-tools.d.ts
CHANGED
|
@@ -112,4 +112,10 @@ export declare function asOptionalArray<T extends any>(toBeArray?: T | T[]): T[]
|
|
|
112
112
|
export declare function lastElement<T extends any>(array: T[] | undefined): T | undefined;
|
|
113
113
|
export declare function firstElement<T extends any>(array?: T[]): T | undefined;
|
|
114
114
|
export declare function arrayIncludesAny<T extends any>(arr1: T[], arr2: T[]): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Returns true if arr1 returns the entirety of arr2
|
|
117
|
+
* @param arr1
|
|
118
|
+
* @param arr2
|
|
119
|
+
*/
|
|
120
|
+
export declare function arrayIncludesAll<T extends any>(arr1: T[], arr2: T[]): boolean;
|
|
115
121
|
export {};
|
package/utils/array-tools.js
CHANGED
|
@@ -26,7 +26,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.arrayIncludesAny = exports.firstElement = exports.lastElement = exports.asOptionalArray = exports.asArray = exports.generateArray = exports.toggleInArray = exports.groupArrayBy = exports.filterFlatInstances = exports.flatArray = exports.batchActionParallel = exports.Promise_all_sequentially = exports.batchAction = exports.sortArray = exports.reduceToMap = exports.arrayToMap = exports.filterFalsy = exports.filterInstances = exports.filterDuplicates = exports.findDuplicates = exports.filterAsync = exports.toggleElementInArray = exports.addItemToArrayAtIndex = exports.addItemToArray = exports.removeFromArrayByIndex = exports.removeFromArray = exports.removeItemFromArray = exports.filterInOut = void 0;
|
|
29
|
+
exports.arrayIncludesAll = exports.arrayIncludesAny = exports.firstElement = exports.lastElement = exports.asOptionalArray = exports.asArray = exports.generateArray = exports.toggleInArray = exports.groupArrayBy = exports.filterFlatInstances = exports.flatArray = exports.batchActionParallel = exports.Promise_all_sequentially = exports.batchAction = exports.sortArray = exports.reduceToMap = exports.arrayToMap = exports.filterFalsy = exports.filterInstances = exports.filterDuplicates = exports.findDuplicates = exports.filterAsync = exports.toggleElementInArray = exports.addItemToArrayAtIndex = exports.addItemToArray = exports.removeFromArrayByIndex = exports.removeFromArray = exports.removeItemFromArray = exports.filterInOut = void 0;
|
|
30
30
|
const tools_1 = require("./tools");
|
|
31
31
|
const object_tools_1 = require("./object-tools");
|
|
32
32
|
function filterInOut(input, filter) {
|
|
@@ -302,3 +302,12 @@ function arrayIncludesAny(arr1, arr2) {
|
|
|
302
302
|
return arr1.some(item => arr2.includes(item));
|
|
303
303
|
}
|
|
304
304
|
exports.arrayIncludesAny = arrayIncludesAny;
|
|
305
|
+
/**
|
|
306
|
+
* Returns true if arr1 returns the entirety of arr2
|
|
307
|
+
* @param arr1
|
|
308
|
+
* @param arr2
|
|
309
|
+
*/
|
|
310
|
+
function arrayIncludesAll(arr1, arr2) {
|
|
311
|
+
return arr2.every(item => arr1.includes(item));
|
|
312
|
+
}
|
|
313
|
+
exports.arrayIncludesAll = arrayIncludesAll;
|
|
@@ -21,8 +21,8 @@ export declare const tsValidateRange: (mandatory?: boolean) => Validator<[number
|
|
|
21
21
|
export declare const tsValidateRegexp: (regexp: RegExp, mandatory?: boolean) => Validator<string>;
|
|
22
22
|
export declare const tsValidateTimestamp: (interval?: number, mandatory?: boolean) => Validator<number>;
|
|
23
23
|
export declare const tsValidateAudit: (range?: RangeTimestamp) => (audit?: AuditBy) => any;
|
|
24
|
-
export declare const tsValidateNonMandatoryObject: <T>(validator: ValidatorTypeResolver<T>) => ((input?: T | undefined) => any)[];
|
|
25
|
-
export declare const tsValidateOptionalObject: <T>(validator: ValidatorTypeResolver<T>) => ((input?: T | undefined) => any)[];
|
|
24
|
+
export declare const tsValidateNonMandatoryObject: <T extends object>(validator: ValidatorTypeResolver<T>) => ((input?: T | undefined) => any)[];
|
|
25
|
+
export declare const tsValidateOptionalObject: <T extends object>(validator: ValidatorTypeResolver<T>) => ((input?: T | undefined) => any)[];
|
|
26
26
|
export declare const tsValidator_valueByKey: <T extends unknown>(validatorObject: {
|
|
27
27
|
[k: string]: Validator<any> | import("./validator-core").TypeValidator<any>;
|
|
28
28
|
}, prop?: string) => ValidatorTypeResolver<T>;
|