@voiceflow/common 7.24.0 → 7.25.0
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.
|
@@ -36,4 +36,5 @@ export declare const isNotNullish: <T>(value: T) => value is NonNullable<T>;
|
|
|
36
36
|
export declare const filterOutNullish: <T>(items: readonly T[]) => NonNullable<T>[];
|
|
37
37
|
export declare const filterAndGetLastRemovedValue: <T>(list: T[], filter: (item: T) => boolean) => [T[], T | null];
|
|
38
38
|
export declare const inferUnion: <T extends ArrayLike<unknown>>(array: T) => import("../types").SafeArray<T[number], T>;
|
|
39
|
+
export declare const toArray: <T>(valueOrArray: T | T[]) => T[];
|
|
39
40
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.inferUnion = exports.filterAndGetLastRemovedValue = exports.filterOutNullish = exports.isNotNullish = exports.isNullish = exports.asyncForEach = exports.hasIdenticalMembers = exports.diff = exports.findUnion = exports.createMap = exports.createEntries = exports.separate = exports.reorder = exports.tail = exports.head = exports.toggleMembership = exports.append = exports.insertAll = exports.insert = exports.replace = exports.withoutValues = exports.withoutValue = exports.without = exports.unique = void 0;
|
|
3
|
+
exports.toArray = exports.inferUnion = exports.filterAndGetLastRemovedValue = exports.filterOutNullish = exports.isNotNullish = exports.isNullish = exports.asyncForEach = exports.hasIdenticalMembers = exports.diff = exports.findUnion = exports.createMap = exports.createEntries = exports.separate = exports.reorder = exports.tail = exports.head = exports.toggleMembership = exports.append = exports.insertAll = exports.insert = exports.replace = exports.withoutValues = exports.withoutValue = exports.without = exports.unique = void 0;
|
|
4
4
|
const unique = (items) => Array.from(new Set(items));
|
|
5
5
|
exports.unique = unique;
|
|
6
6
|
const without = (items, index) => (index < 0 ? items : [...items.slice(0, index), ...items.slice(index + 1)]);
|
|
@@ -123,3 +123,5 @@ const filterAndGetLastRemovedValue = (list, filter) => {
|
|
|
123
123
|
exports.filterAndGetLastRemovedValue = filterAndGetLastRemovedValue;
|
|
124
124
|
const inferUnion = (array) => array;
|
|
125
125
|
exports.inferUnion = inferUnion;
|
|
126
|
+
const toArray = (valueOrArray) => (Array.isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
127
|
+
exports.toArray = toArray;
|
|
@@ -36,4 +36,5 @@ export declare const isNotNullish: <T>(value: T) => value is NonNullable<T>;
|
|
|
36
36
|
export declare const filterOutNullish: <T>(items: readonly T[]) => NonNullable<T>[];
|
|
37
37
|
export declare const filterAndGetLastRemovedValue: <T>(list: T[], filter: (item: T) => boolean) => [T[], T | null];
|
|
38
38
|
export declare const inferUnion: <T extends ArrayLike<unknown>>(array: T) => import("../types").SafeArray<T[number], T>;
|
|
39
|
+
export declare const toArray: <T>(valueOrArray: T | T[]) => T[];
|
|
39
40
|
export {};
|
package/build/esm/utils/array.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voiceflow/common",
|
|
3
3
|
"description": "Junk drawer of utility functions",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.25.0",
|
|
5
5
|
"author": "Voiceflow",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/voiceflow/libs/issues"
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"test:single": "NODE_ENV=test ts-mocha --paths --config config/tests/mocharc.yml",
|
|
77
77
|
"test:unit": "NODE_ENV=test nyc --report-dir=nyc_coverage_unit ts-mocha --paths --config config/tests/mocharc.yml 'tests/**/*.unit.ts'"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "667df22d884b655813e09d2fc6ca0adfb3463a8a"
|
|
80
80
|
}
|