@voiceflow/common 7.24.0 → 7.25.2
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/build/common/constants/regexp.d.ts +1 -0
- package/build/common/constants/regexp.js +2 -1
- package/build/common/types.d.ts +5 -0
- package/build/common/utils/array.d.ts +1 -0
- package/build/common/utils/array.js +3 -1
- package/build/esm/constants/regexp.d.ts +1 -0
- package/build/esm/constants/regexp.js +1 -0
- package/build/esm/types.d.ts +5 -0
- package/build/esm/utils/array.d.ts +1 -0
- package/build/esm/utils/array.js +1 -0
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const SPACE_REGEXP: RegExp;
|
|
2
2
|
export declare const SLOT_REGEXP: RegExp;
|
|
3
|
+
export declare const SLOT_ANNOTATION_SIMPLE_REGEX: RegExp;
|
|
3
4
|
export declare const IS_VARIABLE_REGEXP: RegExp;
|
|
4
5
|
export declare const READABLE_VARIABLE_REGEXP: RegExp;
|
|
5
6
|
export declare const VALID_CHARACTER = "a-zA-Z";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VALID_SAMPLE_UTTERANCE = exports.VALID_SAMPLE_CHARACTERS = exports.VALID_SAMPLE_CHARACTERS_WITHOUT_CURLY_BRACES_OR_SPACES = exports.VALID_SPOKEN_CHARACTER = exports.VALID_LATIN_CHARACTER = exports.VALID_CHARACTER = exports.READABLE_VARIABLE_REGEXP = exports.IS_VARIABLE_REGEXP = exports.SLOT_REGEXP = exports.SPACE_REGEXP = void 0;
|
|
3
|
+
exports.VALID_SAMPLE_UTTERANCE = exports.VALID_SAMPLE_CHARACTERS = exports.VALID_SAMPLE_CHARACTERS_WITHOUT_CURLY_BRACES_OR_SPACES = exports.VALID_SPOKEN_CHARACTER = exports.VALID_LATIN_CHARACTER = exports.VALID_CHARACTER = exports.READABLE_VARIABLE_REGEXP = exports.IS_VARIABLE_REGEXP = exports.SLOT_ANNOTATION_SIMPLE_REGEX = exports.SLOT_REGEXP = exports.SPACE_REGEXP = void 0;
|
|
4
4
|
exports.SPACE_REGEXP = / /g;
|
|
5
5
|
exports.SLOT_REGEXP = /{{\[([^ .[\]{}]*?)]\.([^ .[\]{}]*?)}}/g;
|
|
6
|
+
exports.SLOT_ANNOTATION_SIMPLE_REGEX = /{([^ .[\]{}]+?)}/g;
|
|
6
7
|
exports.IS_VARIABLE_REGEXP = /^{.*}$/;
|
|
7
8
|
exports.READABLE_VARIABLE_REGEXP = /{(\w{1,64})}/g;
|
|
8
9
|
exports.VALID_CHARACTER = 'a-zA-Z';
|
package/build/common/types.d.ts
CHANGED
|
@@ -38,3 +38,8 @@ export declare type ArrayUnionToIntersection<T extends ArrayLike<unknown>> = Saf
|
|
|
38
38
|
export declare type PrimitiveMap<T extends PropertyKey> = {
|
|
39
39
|
[P in T]: P;
|
|
40
40
|
};
|
|
41
|
+
export declare type Join<T extends any[]> = T extends [AnyRecord, ...infer R] ? T[0] & Join<R> : {};
|
|
42
|
+
export declare type Tuple<T1, T2> = [T1, T2];
|
|
43
|
+
export declare type TupleFirst<T> = T extends Tuple<infer R, any> ? R : never;
|
|
44
|
+
export declare type TupleSecond<T> = T extends Tuple<any, infer R> ? R : never;
|
|
45
|
+
export declare type Pair<T> = Tuple<T, T>;
|
|
@@ -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;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const SPACE_REGEXP: RegExp;
|
|
2
2
|
export declare const SLOT_REGEXP: RegExp;
|
|
3
|
+
export declare const SLOT_ANNOTATION_SIMPLE_REGEX: RegExp;
|
|
3
4
|
export declare const IS_VARIABLE_REGEXP: RegExp;
|
|
4
5
|
export declare const READABLE_VARIABLE_REGEXP: RegExp;
|
|
5
6
|
export declare const VALID_CHARACTER = "a-zA-Z";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const SPACE_REGEXP = / /g;
|
|
2
2
|
export const SLOT_REGEXP = /{{\[([^ .[\]{}]*?)]\.([^ .[\]{}]*?)}}/g;
|
|
3
|
+
export const SLOT_ANNOTATION_SIMPLE_REGEX = /{([^ .[\]{}]+?)}/g;
|
|
3
4
|
export const IS_VARIABLE_REGEXP = /^{.*}$/;
|
|
4
5
|
export const READABLE_VARIABLE_REGEXP = /{(\w{1,64})}/g;
|
|
5
6
|
export const VALID_CHARACTER = 'a-zA-Z';
|
package/build/esm/types.d.ts
CHANGED
|
@@ -38,3 +38,8 @@ export declare type ArrayUnionToIntersection<T extends ArrayLike<unknown>> = Saf
|
|
|
38
38
|
export declare type PrimitiveMap<T extends PropertyKey> = {
|
|
39
39
|
[P in T]: P;
|
|
40
40
|
};
|
|
41
|
+
export declare type Join<T extends any[]> = T extends [AnyRecord, ...infer R] ? T[0] & Join<R> : {};
|
|
42
|
+
export declare type Tuple<T1, T2> = [T1, T2];
|
|
43
|
+
export declare type TupleFirst<T> = T extends Tuple<infer R, any> ? R : never;
|
|
44
|
+
export declare type TupleSecond<T> = T extends Tuple<any, infer R> ? R : never;
|
|
45
|
+
export declare type Pair<T> = Tuple<T, T>;
|
|
@@ -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.2",
|
|
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": "13bae0c256520e18682b0b3f1e4c16693f092c68"
|
|
80
80
|
}
|