@voiceflow/common 8.2.8 → 8.3.1
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/cjs/constants/environment.js +1 -1
- package/build/cjs/constants/regexp.d.ts +5 -5
- package/build/cjs/constants/regexp.d.ts.map +1 -1
- package/build/cjs/crypto/base64.js +4 -4
- package/build/cjs/crypto/hex2abc.d.ts.map +1 -1
- package/build/cjs/crypto/synchronous.d.ts +1 -1
- package/build/cjs/crypto/synchronous.d.ts.map +1 -1
- package/build/cjs/crypto/synchronous.js +2 -2
- package/build/cjs/types.d.ts +26 -26
- package/build/cjs/types.d.ts.map +1 -1
- package/build/cjs/utils/array.d.ts +3 -3
- package/build/cjs/utils/array.d.ts.map +1 -1
- package/build/cjs/utils/array.js +2 -3
- package/build/cjs/utils/emails.d.ts.map +1 -1
- package/build/cjs/utils/functional.d.ts +4 -4
- package/build/cjs/utils/functional.d.ts.map +1 -1
- package/build/cjs/utils/functional.js +0 -1
- package/build/cjs/utils/id.d.ts +1 -1
- package/build/cjs/utils/id.d.ts.map +1 -1
- package/build/cjs/utils/intent.d.ts +6 -6
- package/build/cjs/utils/intent.d.ts.map +1 -1
- package/build/cjs/utils/intent.js +5 -3
- package/build/cjs/utils/mathjs.js +1 -1
- package/build/cjs/utils/normalized.d.ts +5 -5
- package/build/cjs/utils/normalized.d.ts.map +1 -1
- package/build/cjs/utils/number.d.ts.map +1 -1
- package/build/cjs/utils/number.js +2 -2
- package/build/cjs/utils/object/common.d.ts +1 -1
- package/build/cjs/utils/object/common.d.ts.map +1 -1
- package/build/cjs/utils/object/common.js +2 -2
- package/build/cjs/utils/object/deepMap.d.ts +1 -1
- package/build/cjs/utils/object/deepMap.d.ts.map +1 -1
- package/build/cjs/utils/object/deepMap.js +0 -2
- package/build/cjs/utils/object/diff.d.ts +1 -1
- package/build/cjs/utils/object/diff.d.ts.map +1 -1
- package/build/cjs/utils/object/diff.js +2 -2
- package/build/cjs/utils/object/keys.d.ts +2 -1
- package/build/cjs/utils/object/keys.d.ts.map +1 -1
- package/build/cjs/utils/promise.d.ts.map +1 -1
- package/build/cjs/utils/protocol.d.ts +2 -2
- package/build/cjs/utils/protocol.d.ts.map +1 -1
- package/build/cjs/utils/slot.d.ts.map +1 -1
- package/build/cjs/utils/slot.js +2 -2
- package/build/cjs/utils/time.js +14 -14
- package/build/cjs/utils/typeguard.d.ts +2 -2
- package/build/cjs/utils/typeguard.d.ts.map +1 -1
- package/build/cjs/utils/variables.d.ts +2 -2
- package/build/cjs/utils/variables.d.ts.map +1 -1
- package/build/esm/constants/regexp.d.ts +5 -5
- package/build/esm/constants/regexp.d.ts.map +1 -1
- package/build/esm/crypto/base64.js +2 -2
- package/build/esm/crypto/hex2abc.d.ts.map +1 -1
- package/build/esm/crypto/synchronous.d.ts +1 -1
- package/build/esm/crypto/synchronous.d.ts.map +1 -1
- package/build/esm/crypto/synchronous.js +1 -1
- package/build/esm/types.d.ts +26 -26
- package/build/esm/types.d.ts.map +1 -1
- package/build/esm/utils/array.d.ts +3 -3
- package/build/esm/utils/array.d.ts.map +1 -1
- package/build/esm/utils/array.js +2 -3
- package/build/esm/utils/emails.d.ts.map +1 -1
- package/build/esm/utils/functional.d.ts +4 -4
- package/build/esm/utils/functional.d.ts.map +1 -1
- package/build/esm/utils/functional.js +0 -1
- package/build/esm/utils/id.d.ts +1 -1
- package/build/esm/utils/id.d.ts.map +1 -1
- package/build/esm/utils/intent.d.ts +6 -6
- package/build/esm/utils/intent.d.ts.map +1 -1
- package/build/esm/utils/intent.js +5 -3
- package/build/esm/utils/mathjs.js +1 -1
- package/build/esm/utils/normalized.d.ts +5 -5
- package/build/esm/utils/normalized.d.ts.map +1 -1
- package/build/esm/utils/number.d.ts.map +1 -1
- package/build/esm/utils/number.js +1 -1
- package/build/esm/utils/object/common.d.ts +1 -1
- package/build/esm/utils/object/common.d.ts.map +1 -1
- package/build/esm/utils/object/common.js +1 -1
- package/build/esm/utils/object/deepMap.d.ts +1 -1
- package/build/esm/utils/object/deepMap.d.ts.map +1 -1
- package/build/esm/utils/object/deepMap.js +0 -2
- package/build/esm/utils/object/diff.d.ts +1 -1
- package/build/esm/utils/object/diff.d.ts.map +1 -1
- package/build/esm/utils/object/diff.js +1 -1
- package/build/esm/utils/object/keys.d.ts +2 -1
- package/build/esm/utils/object/keys.d.ts.map +1 -1
- package/build/esm/utils/promise.d.ts.map +1 -1
- package/build/esm/utils/protocol.d.ts +2 -2
- package/build/esm/utils/protocol.d.ts.map +1 -1
- package/build/esm/utils/slot.d.ts.map +1 -1
- package/build/esm/utils/slot.js +1 -1
- package/build/esm/utils/time.js +7 -7
- package/build/esm/utils/typeguard.d.ts +2 -2
- package/build/esm/utils/typeguard.d.ts.map +1 -1
- package/build/esm/utils/variables.d.ts +2 -2
- package/build/esm/utils/variables.d.ts.map +1 -1
- package/package.json +46 -48
- package/build/cjs/crypto/hex2abc.test.d.ts +0 -2
- package/build/cjs/crypto/hex2abc.test.d.ts.map +0 -1
- package/build/cjs/crypto/hex2abc.test.js +0 -12
- package/build/cjs/crypto/murmurhash.test.d.ts +0 -2
- package/build/cjs/crypto/murmurhash.test.d.ts.map +0 -1
- package/build/cjs/crypto/murmurhash.test.js +0 -23
- package/build/cjs/utils/__fixtures__/name.json +0 -64
- package/build/cjs/utils/array.test.d.ts +0 -2
- package/build/cjs/utils/array.test.d.ts.map +0 -1
- package/build/cjs/utils/array.test.js +0 -237
- package/build/cjs/utils/email.test.d.ts +0 -2
- package/build/cjs/utils/email.test.d.ts.map +0 -1
- package/build/cjs/utils/email.test.js +0 -22
- package/build/cjs/utils/functional.test.d.ts +0 -2
- package/build/cjs/utils/functional.test.d.ts.map +0 -1
- package/build/cjs/utils/functional.test.js +0 -139
- package/build/cjs/utils/id.test.d.ts +0 -2
- package/build/cjs/utils/id.test.d.ts.map +0 -1
- package/build/cjs/utils/id.test.js +0 -66
- package/build/cjs/utils/intent.test.d.ts +0 -2
- package/build/cjs/utils/intent.test.d.ts.map +0 -1
- package/build/cjs/utils/intent.test.js +0 -100
- package/build/cjs/utils/map.test.d.ts +0 -2
- package/build/cjs/utils/map.test.d.ts.map +0 -1
- package/build/cjs/utils/map.test.js +0 -22
- package/build/cjs/utils/object/common.test.d.ts +0 -2
- package/build/cjs/utils/object/common.test.d.ts.map +0 -1
- package/build/cjs/utils/object/common.test.js +0 -175
- package/build/cjs/utils/object/deepMap.test.d.ts +0 -2
- package/build/cjs/utils/object/deepMap.test.d.ts.map +0 -1
- package/build/cjs/utils/object/deepMap.test.js +0 -114
- package/build/cjs/utils/object/diff.test.d.ts +0 -2
- package/build/cjs/utils/object/diff.test.d.ts.map +0 -1
- package/build/cjs/utils/object/diff.test.js +0 -19
- package/build/cjs/utils/object/keys.test.d.ts +0 -2
- package/build/cjs/utils/object/keys.test.d.ts.map +0 -1
- package/build/cjs/utils/object/keys.test.js +0 -15
- package/build/cjs/utils/promise.test.d.ts +0 -2
- package/build/cjs/utils/promise.test.d.ts.map +0 -1
- package/build/cjs/utils/promise.test.js +0 -25
- package/build/cjs/utils/protocol.test.d.ts +0 -2
- package/build/cjs/utils/protocol.test.d.ts.map +0 -1
- package/build/cjs/utils/protocol.test.js +0 -40
- package/build/cjs/utils/slot.test.d.ts +0 -2
- package/build/cjs/utils/slot.test.d.ts.map +0 -1
- package/build/cjs/utils/slot.test.js +0 -38
- package/build/cjs/utils/string.test.d.ts +0 -2
- package/build/cjs/utils/string.test.d.ts.map +0 -1
- package/build/cjs/utils/string.test.js +0 -53
- package/build/cjs/utils/timezones.test.d.ts +0 -2
- package/build/cjs/utils/timezones.test.d.ts.map +0 -1
- package/build/cjs/utils/timezones.test.js +0 -12
- package/build/cjs/utils/typeguard.test.d.ts +0 -2
- package/build/cjs/utils/typeguard.test.d.ts.map +0 -1
- package/build/cjs/utils/typeguard.test.js +0 -55
- package/build/esm/crypto/hex2abc.test.d.ts +0 -2
- package/build/esm/crypto/hex2abc.test.d.ts.map +0 -1
- package/build/esm/crypto/hex2abc.test.js +0 -10
- package/build/esm/crypto/murmurhash.test.d.ts +0 -2
- package/build/esm/crypto/murmurhash.test.d.ts.map +0 -1
- package/build/esm/crypto/murmurhash.test.js +0 -21
- package/build/esm/utils/__fixtures__/name.json +0 -64
- package/build/esm/utils/array.test.d.ts +0 -2
- package/build/esm/utils/array.test.d.ts.map +0 -1
- package/build/esm/utils/array.test.js +0 -235
- package/build/esm/utils/email.test.d.ts +0 -2
- package/build/esm/utils/email.test.d.ts.map +0 -1
- package/build/esm/utils/email.test.js +0 -20
- package/build/esm/utils/functional.test.d.ts +0 -2
- package/build/esm/utils/functional.test.d.ts.map +0 -1
- package/build/esm/utils/functional.test.js +0 -137
- package/build/esm/utils/id.test.d.ts +0 -2
- package/build/esm/utils/id.test.d.ts.map +0 -1
- package/build/esm/utils/id.test.js +0 -64
- package/build/esm/utils/intent.test.d.ts +0 -2
- package/build/esm/utils/intent.test.d.ts.map +0 -1
- package/build/esm/utils/intent.test.js +0 -75
- package/build/esm/utils/map.test.d.ts +0 -2
- package/build/esm/utils/map.test.d.ts.map +0 -1
- package/build/esm/utils/map.test.js +0 -20
- package/build/esm/utils/object/common.test.d.ts +0 -2
- package/build/esm/utils/object/common.test.d.ts.map +0 -1
- package/build/esm/utils/object/common.test.js +0 -173
- package/build/esm/utils/object/deepMap.test.d.ts +0 -2
- package/build/esm/utils/object/deepMap.test.d.ts.map +0 -1
- package/build/esm/utils/object/deepMap.test.js +0 -109
- package/build/esm/utils/object/diff.test.d.ts +0 -2
- package/build/esm/utils/object/diff.test.d.ts.map +0 -1
- package/build/esm/utils/object/diff.test.js +0 -17
- package/build/esm/utils/object/keys.test.d.ts +0 -2
- package/build/esm/utils/object/keys.test.d.ts.map +0 -1
- package/build/esm/utils/object/keys.test.js +0 -13
- package/build/esm/utils/promise.test.d.ts +0 -2
- package/build/esm/utils/promise.test.d.ts.map +0 -1
- package/build/esm/utils/promise.test.js +0 -23
- package/build/esm/utils/protocol.test.d.ts +0 -2
- package/build/esm/utils/protocol.test.d.ts.map +0 -1
- package/build/esm/utils/protocol.test.js +0 -38
- package/build/esm/utils/slot.test.d.ts +0 -2
- package/build/esm/utils/slot.test.d.ts.map +0 -1
- package/build/esm/utils/slot.test.js +0 -13
- package/build/esm/utils/string.test.d.ts +0 -2
- package/build/esm/utils/string.test.d.ts.map +0 -1
- package/build/esm/utils/string.test.js +0 -51
- package/build/esm/utils/timezones.test.d.ts +0 -2
- package/build/esm/utils/timezones.test.d.ts.map +0 -1
- package/build/esm/utils/timezones.test.js +0 -10
- package/build/esm/utils/typeguard.test.d.ts +0 -2
- package/build/esm/utils/typeguard.test.d.ts.map +0 -1
- package/build/esm/utils/typeguard.test.js +0 -53
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diff.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/object/diff.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const diff_1 = require("./diff");
|
|
4
|
-
describe('Utils | object | diff', () => {
|
|
5
|
-
describe('getTopLevelDiff()', () => {
|
|
6
|
-
it('gets diff of arrays', () => {
|
|
7
|
-
expect((0, diff_1.getTopLevelDiff)(['foo', 'bar', 'fuzz'], ['fizz', 'buzz', 'fuzz'])).toEqual(['foo', 'bar']);
|
|
8
|
-
});
|
|
9
|
-
it('gets diff of objects', () => {
|
|
10
|
-
expect((0, diff_1.getTopLevelDiff)({ foo: 1, bar: 2, fuzz: 3 }, { fizz: 4, buzz: 5, fuzz: 3 })).toEqual({ foo: 1, bar: 2 });
|
|
11
|
-
});
|
|
12
|
-
it('gets diff of objects with custom compare', () => {
|
|
13
|
-
expect((0, diff_1.getTopLevelDiff)({ foo: 1, bar: 2, fuzz: 6 }, { fizz: 4, buzz: 5, fuzz: 9 }, (lhs, rhs) => typeof lhs === typeof rhs)).toEqual({
|
|
14
|
-
foo: 1,
|
|
15
|
-
bar: 2,
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keys.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/object/keys.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const keys_1 = require("./keys");
|
|
4
|
-
describe('Utils | object | keys', () => {
|
|
5
|
-
describe('getKeys()', () => {
|
|
6
|
-
it('gets keys with a strict type', () => {
|
|
7
|
-
const foo = Symbol('foo');
|
|
8
|
-
const bar = Symbol('bar');
|
|
9
|
-
const fizz = Symbol('fizz');
|
|
10
|
-
const keys = (0, keys_1.getKeys)({ [foo]: 1, [bar]: 2, [fizz]: 3 });
|
|
11
|
-
// this would throw a compiler error if `keys[0]` was a `string`
|
|
12
|
-
keys[0] === foo;
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promise.test.d.ts","sourceRoot":"","sources":["../../../src/utils/promise.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const promise_1 = require("./promise");
|
|
4
|
-
describe('Utils | promise', () => {
|
|
5
|
-
describe('delay()', () => {
|
|
6
|
-
it('delay for the provided time before resolving', async () => {
|
|
7
|
-
const timeout = 10;
|
|
8
|
-
const start = Date.now();
|
|
9
|
-
await (0, promise_1.delay)(timeout);
|
|
10
|
-
expect(Date.now() - start).toBeGreaterThanOrEqual(timeout);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
describe('rejectIn()', () => {
|
|
14
|
-
it('delay for the provided time before rejecting', async () => {
|
|
15
|
-
const timeout = 10;
|
|
16
|
-
const start = Date.now();
|
|
17
|
-
try {
|
|
18
|
-
await (0, promise_1.rejectIn)(timeout);
|
|
19
|
-
}
|
|
20
|
-
catch (err) {
|
|
21
|
-
expect(Date.now() - start).toBeGreaterThanOrEqual(timeout);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.test.d.ts","sourceRoot":"","sources":["../../../src/utils/protocol.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const protocol_1 = require("./protocol");
|
|
4
|
-
describe('Utils | protocol', () => {
|
|
5
|
-
describe('typeFactory()', () => {
|
|
6
|
-
it('should generate a prefixed type', () => {
|
|
7
|
-
expect((0, protocol_1.typeFactory)('red', 'blue')('green')).toBe('red.blue.green');
|
|
8
|
-
});
|
|
9
|
-
});
|
|
10
|
-
describe('Channel', () => {
|
|
11
|
-
describe('build()', () => {
|
|
12
|
-
it('store original build function directly', () => {
|
|
13
|
-
const channel = new protocol_1.Channel(['foo', 'bar'], ({ foo, bar }) => `${foo}/fizz/buzz/${bar}`);
|
|
14
|
-
expect(channel.build({ foo: '123', bar: '456' })).toBe('123/fizz/buzz/456');
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
describe('buildMatcher()', () => {
|
|
18
|
-
it('store build a matcher using the provided argument names', () => {
|
|
19
|
-
const channel = new protocol_1.Channel(['foo', 'bar'], ({ foo, bar }) => `${foo}/fizz/buzz/${bar}`);
|
|
20
|
-
expect(channel.buildMatcher()).toBe(':foo/fizz/buzz/:bar');
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
describe('extend()', () => {
|
|
24
|
-
it('create a channel built to be suffixed to the output of an existing channel', () => {
|
|
25
|
-
const fooChannel = new protocol_1.Channel(['foo'], ({ foo }) => `foo/${foo}`);
|
|
26
|
-
const barChannel = fooChannel.extend(['bar'], ({ bar }) => `bar/${bar}`);
|
|
27
|
-
expect(barChannel.buildMatcher()).toBe('foo/:foo/bar/:bar');
|
|
28
|
-
expect(barChannel.build({ foo: '123', bar: '456' })).toBe('foo/123/bar/456');
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
describe('createChannel()', () => {
|
|
32
|
-
it('constructs a new Channel', () => {
|
|
33
|
-
const channel = (0, protocol_1.createChannel)(['foo'], ({ foo }) => `foo/${foo}`);
|
|
34
|
-
expect(channel).toBeInstanceOf(protocol_1.Channel);
|
|
35
|
-
expect(channel.buildMatcher()).toBe('foo/:foo');
|
|
36
|
-
expect(channel.build({ foo: '123' })).toBe('foo/123');
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot.test.d.ts","sourceRoot":"","sources":["../../../src/utils/slot.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const SlotUtils = __importStar(require("./slot"));
|
|
27
|
-
describe('Utils | slot', () => {
|
|
28
|
-
describe('getValueWithSynonyms', () => {
|
|
29
|
-
it('extracts synonyms', () => {
|
|
30
|
-
expect(SlotUtils.getValueWithSynonyms('a, b, c, d')).toEqual(['a', ['b', 'c', 'd']]);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
describe('mapSlotAnnotations', () => {
|
|
34
|
-
it('renames keys and maps', () => {
|
|
35
|
-
expect(SlotUtils.mapSlotAnnotations('test {{[name].key}} thing', () => ({ key: 'newKey', name: 'newName' }))).toEqual('test {{[newName].newKey}} thing');
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.test.d.ts","sourceRoot":"","sources":["../../../src/utils/string.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const string_1 = require("./string");
|
|
4
|
-
describe('Utils | string', () => {
|
|
5
|
-
describe('capitalizeFirstLetter()', () => {
|
|
6
|
-
it('capitalizes the first letter', () => {
|
|
7
|
-
expect((0, string_1.capitalizeFirstLetter)('')).toBe('');
|
|
8
|
-
expect((0, string_1.capitalizeFirstLetter)('123')).toBe('123');
|
|
9
|
-
expect((0, string_1.capitalizeFirstLetter)('abc')).toBe('Abc');
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
describe('capitalizeAllWords()', () => {
|
|
13
|
-
it('capitalizes all the space-delimited words', () => {
|
|
14
|
-
expect((0, string_1.capitalizeAllWords)('')).toBe('');
|
|
15
|
-
expect((0, string_1.capitalizeAllWords)('abc')).toBe('Abc');
|
|
16
|
-
expect((0, string_1.capitalizeAllWords)('abc def')).toBe('Abc Def');
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
describe('arrayStringReplace()', () => {
|
|
20
|
-
it('replace a pattern for each item in an array', () => {
|
|
21
|
-
expect((0, string_1.arrayStringReplace)('x', 'y', [])).toEqual([]);
|
|
22
|
-
expect((0, string_1.arrayStringReplace)('x', 'y', ['foo'])).toEqual(['foo']);
|
|
23
|
-
expect((0, string_1.arrayStringReplace)('x', 'y', ['xyz', 'foo', 'fox', 'bar'])).toEqual(['yyz', 'foo', 'foy', 'bar']);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
describe('stripHTMLTags()', () => {
|
|
27
|
-
it('remove HTML tags from a string', () => {
|
|
28
|
-
expect((0, string_1.stripHTMLTags)('')).toBe('');
|
|
29
|
-
expect((0, string_1.stripHTMLTags)('<')).toBe('<');
|
|
30
|
-
expect((0, string_1.stripHTMLTags)('<>')).toBe('<>');
|
|
31
|
-
expect((0, string_1.stripHTMLTags)('<foo>')).toBe('');
|
|
32
|
-
expect((0, string_1.stripHTMLTags)('a b c d')).toBe('a b c d');
|
|
33
|
-
expect((0, string_1.stripHTMLTags)('a <foo> b <bar> c <fizz> d')).toBe('a b c d');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
describe('removeTrailingUnderscores()', () => {
|
|
37
|
-
it('remove leading and trailing underscore characters', () => {
|
|
38
|
-
expect((0, string_1.removeTrailingUnderscores)('')).toBe('');
|
|
39
|
-
expect((0, string_1.removeTrailingUnderscores)('foo')).toBe('foo');
|
|
40
|
-
expect((0, string_1.removeTrailingUnderscores)('__foo')).toBe('foo');
|
|
41
|
-
expect((0, string_1.removeTrailingUnderscores)('foo__')).toBe('foo');
|
|
42
|
-
expect((0, string_1.removeTrailingUnderscores)('__foo__')).toBe('foo');
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
describe('conditionalReplace()', () => {
|
|
46
|
-
it('do nothing with falsey value', () => {
|
|
47
|
-
expect((0, string_1.conditionalReplace)('fizz', /i/)).toBe('fizz');
|
|
48
|
-
});
|
|
49
|
-
it('use truthy value as replacement value', () => {
|
|
50
|
-
expect((0, string_1.conditionalReplace)('fizz', /i/, 'u')).toBe('fuzz');
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timezones.test.d.ts","sourceRoot":"","sources":["../../../src/utils/timezones.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const array_1 = require("./array");
|
|
4
|
-
const timezones_1 = require("./timezones");
|
|
5
|
-
describe('Utils | timezones', () => {
|
|
6
|
-
describe('TIMEZONES', () => {
|
|
7
|
-
it('a list of all timezones', () => {
|
|
8
|
-
expect(timezones_1.TIMEZONES.length).toBe(490);
|
|
9
|
-
expect((0, array_1.unique)(timezones_1.TIMEZONES)).toEqual(timezones_1.TIMEZONES);
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeguard.test.d.ts","sourceRoot":"","sources":["../../../src/utils/typeguard.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const typeguard_1 = require("./typeguard");
|
|
4
|
-
describe('Utils | typeguard', () => {
|
|
5
|
-
describe('createTypeguardCreator()', () => {
|
|
6
|
-
it('casts the guarded argument', () => {
|
|
7
|
-
const createTypeguard = (0, typeguard_1.createTypeguardCreator)();
|
|
8
|
-
const input = 'foo';
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
-
const assertTyped = (_arg) => undefined;
|
|
11
|
-
const typeguard = createTypeguard('foo');
|
|
12
|
-
if (typeguard(input)) {
|
|
13
|
-
assertTyped(input);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
it('typeguard against a single value', () => {
|
|
17
|
-
const createTypeguard = (0, typeguard_1.createTypeguardCreator)();
|
|
18
|
-
const typeguard = createTypeguard('foo');
|
|
19
|
-
expect(typeguard('foo')).toBe(true);
|
|
20
|
-
expect(typeguard('bar')).toBe(false);
|
|
21
|
-
});
|
|
22
|
-
it('typeguard against an array of values', () => {
|
|
23
|
-
const createTypeguard = (0, typeguard_1.createTypeguardCreator)();
|
|
24
|
-
const typeguard = createTypeguard(['foo', 'bar']);
|
|
25
|
-
expect(typeguard('foo')).toBe(true);
|
|
26
|
-
expect(typeguard('bar')).toBe(true);
|
|
27
|
-
expect(typeguard('fizz')).toBe(false);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
describe('createTypedTypeguardCreator()', () => {
|
|
31
|
-
it('casts the guarded argument', () => {
|
|
32
|
-
const createTypeguard = (0, typeguard_1.createTypedTypeguardCreator)();
|
|
33
|
-
const input = { type: 'foo', id: 123 };
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
35
|
-
const assertTyped = (_arg) => undefined;
|
|
36
|
-
const typeguard = createTypeguard('foo');
|
|
37
|
-
if (typeguard(input)) {
|
|
38
|
-
assertTyped(input);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
it('typeguard against a single value', () => {
|
|
42
|
-
const createTypeguard = (0, typeguard_1.createTypedTypeguardCreator)();
|
|
43
|
-
const typeguard = createTypeguard('foo');
|
|
44
|
-
expect(typeguard({ type: 'foo', id: 1 })).toBe(true);
|
|
45
|
-
expect(typeguard({ type: 'bar', id: 2 })).toBe(false);
|
|
46
|
-
});
|
|
47
|
-
it('typeguard against an array of values', () => {
|
|
48
|
-
const createTypeguard = (0, typeguard_1.createTypedTypeguardCreator)();
|
|
49
|
-
const typeguard = createTypeguard(['foo', 'bar']);
|
|
50
|
-
expect(typeguard({ type: 'foo', id: 1 })).toBe(true);
|
|
51
|
-
expect(typeguard({ type: 'bar', id: 2 })).toBe(true);
|
|
52
|
-
expect(typeguard({ type: 'fizz', id: 3 })).toBe(false);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hex2abc.test.d.ts","sourceRoot":"","sources":["../../../src/crypto/hex2abc.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { hex2abc } from './hex2abc.js';
|
|
2
|
-
describe('hex2abc()', () => {
|
|
3
|
-
it('works', () => {
|
|
4
|
-
expect(hex2abc('abcdef')).toBe('abcdef');
|
|
5
|
-
expect(hex2abc('0123456789')).toBe('ghijklmnop');
|
|
6
|
-
});
|
|
7
|
-
it('works with 0x prefixes', () => {
|
|
8
|
-
expect(hex2abc('0xabc123')).toBe('gxabchij');
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"murmurhash.test.d.ts","sourceRoot":"","sources":["../../../src/crypto/murmurhash.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { MurmurHash } from './murmurhash.js';
|
|
2
|
-
// for second test check (4 byte chunk)
|
|
3
|
-
// const buf_left = Buffer.of(0xff, 0xff, 0xff, 0xff);
|
|
4
|
-
// const buf_right = Buffer.of(0x76, 0x29, 0x3b, 0x50);
|
|
5
|
-
// for third test check (correct endian order)
|
|
6
|
-
// const buf_left_two = Buffer.of(0x21, 0x43, 0x65, 0x87);
|
|
7
|
-
// const buf_right_two = Buffer.of(0xf5, 0x5b, 0x51, 0x6b);
|
|
8
|
-
describe('hash()', () => {
|
|
9
|
-
it('return a 32-bit hash resulting from the murmurhash3 algorithm', () => {
|
|
10
|
-
expect(MurmurHash.hash('hello', 0)).toBe('lokkdakm');
|
|
11
|
-
expect(MurmurHash.hash('hello world', 0)).toBe('kkehkpgl');
|
|
12
|
-
expect(MurmurHash.hash('helloworld', 0)).toBe('holkilfm');
|
|
13
|
-
expect(MurmurHash.hash('HELLOWORLD', 0)).toBe('dohkopda');
|
|
14
|
-
expect(MurmurHash.hash('', 0)).toBe('g'); // not sure why '0000 0000' fails as a test
|
|
15
|
-
expect(MurmurHash.hash('abc', 0)).toBe('bjddpjfa');
|
|
16
|
-
expect(MurmurHash.hash('ABC', 0)).toBe('kjchcljl');
|
|
17
|
-
// from https://github.com/jonahsnider/murmurhash-wasm/blob/main/test/murmur-hash3/hash-32.test.ts
|
|
18
|
-
// expect(MurmurHash.hash(buf_left.toString('hex'), 0)).to.eql(buf_right.toString('hex'));
|
|
19
|
-
// expect(MurmurHash.hash(buf_left_two.toString('hex'), 0)).to.eql(buf_right_two.toString('hex'));
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"slots": [
|
|
3
|
-
{
|
|
4
|
-
"key": "4i3h3mmi",
|
|
5
|
-
"name": "slotmans",
|
|
6
|
-
"type": {
|
|
7
|
-
"value": "custom"
|
|
8
|
-
},
|
|
9
|
-
"color": "#4F9ED1",
|
|
10
|
-
"inputs": ["tyler", "john", "scott", "michael", "william", "andy", "peter", "frank", "igor", "steven", "jessica"]
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"intents": [
|
|
14
|
-
{
|
|
15
|
-
"key": "3sb53sup",
|
|
16
|
-
"name": "name_intent",
|
|
17
|
-
"slots": [
|
|
18
|
-
{
|
|
19
|
-
"id": "4i3h3mmi",
|
|
20
|
-
"dialog": {
|
|
21
|
-
"prompt": [
|
|
22
|
-
{
|
|
23
|
-
"text": "",
|
|
24
|
-
"slots": []
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"confirm": [
|
|
28
|
-
{
|
|
29
|
-
"text": "",
|
|
30
|
-
"slots": []
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"utterances": [
|
|
34
|
-
{
|
|
35
|
-
"text": "{{[name].4i3h3mmi}} ",
|
|
36
|
-
"slots": ["4i3h3mmi"]
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
"confirmEnabled": false
|
|
40
|
-
},
|
|
41
|
-
"required": false
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
"inputs": [
|
|
45
|
-
{
|
|
46
|
-
"text": "It's {{[slotmans].4i3h3mmi}}",
|
|
47
|
-
"slots": ["4i3h3mmi"]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"text": "I'm {{[slotmans].4i3h3mmi}}",
|
|
51
|
-
"slots": ["4i3h3mmi"]
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"text": "{{[slotmans].4i3h3mmi}}",
|
|
55
|
-
"slots": ["4i3h3mmi"]
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"text": "my name is {{[slotmans].4i3h3mmi}}",
|
|
59
|
-
"slots": ["4i3h3mmi"]
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.test.d.ts","sourceRoot":"","sources":["../../../src/utils/array.test.ts"],"names":[],"mappings":""}
|