@sparted/shared-library 0.0.13 → 0.0.14
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/_virtual/_tslib.js +1 -50
- package/_virtual/_tslib.js.map +1 -1
- package/array/array-to-map.js +6 -9
- package/array/array-to-map.js.map +1 -1
- package/array/get-values-from-keys.js +2 -2
- package/array/get-values-from-keys.js.map +1 -1
- package/date/constants.js +4 -4
- package/date/constants.js.map +1 -1
- package/date/convert.js +2 -2
- package/date/convert.js.map +1 -1
- package/date/format-minutes.js +6 -6
- package/date/format-minutes.js.map +1 -1
- package/date/get-time-diff-as-string.js +30 -32
- package/date/get-time-diff-as-string.js.map +1 -1
- package/formatting/format-number.js +7 -7
- package/formatting/format-number.js.map +1 -1
- package/fp/run-while.js +5 -6
- package/fp/run-while.js.map +1 -1
- package/http/encode-search-object.js +9 -13
- package/http/encode-search-object.js.map +1 -1
- package/http/fetch-with-timeout.js +6 -6
- package/http/fetch-with-timeout.js.map +1 -1
- package/linked-list/apply-diff-linked-list.js +2 -2
- package/linked-list/apply-diff-linked-list.js.map +1 -1
- package/linked-list/create-linked-list.js +24 -24
- package/linked-list/create-linked-list.js.map +1 -1
- package/linked-list/find-linked-list.js +2 -3
- package/linked-list/find-linked-list.js.map +1 -1
- package/linked-list/get-linked-list.js +1 -1
- package/linked-list/get-linked-list.js.map +1 -1
- package/linked-list/insert-linked-list.js +11 -13
- package/linked-list/insert-linked-list.js.map +1 -1
- package/linked-list/linked-list-utils.js +26 -27
- package/linked-list/linked-list-utils.js.map +1 -1
- package/linked-list/reduce-linked-list.js +5 -5
- package/linked-list/reduce-linked-list.js.map +1 -1
- package/linked-list/remove-linked-list.js +11 -12
- package/linked-list/remove-linked-list.js.map +1 -1
- package/linked-list/update-linked-list.js +6 -7
- package/linked-list/update-linked-list.js.map +1 -1
- package/linked-list/while-linked-list.js +4 -5
- package/linked-list/while-linked-list.js.map +1 -1
- package/math/clamp-number.js +2 -3
- package/math/clamp-number.js.map +1 -1
- package/math/interpolate.js +4 -4
- package/math/interpolate.js.map +1 -1
- package/math/number-range.js +3 -4
- package/math/number-range.js.map +1 -1
- package/math/random-number.js +2 -3
- package/math/random-number.js.map +1 -1
- package/object/merge-deep.js +6 -9
- package/object/merge-deep.js.map +1 -1
- package/package.json +1 -1
- package/parsing/parse-boolean.js +1 -1
- package/parsing/parse-boolean.js.map +1 -1
- package/parsing/parse-enum.js +3 -3
- package/parsing/parse-enum.js.map +1 -1
- package/parsing/parse-number.js +2 -2
- package/parsing/parse-number.js.map +1 -1
- package/predicates/is-function.js +1 -1
- package/predicates/is-function.js.map +1 -1
- package/predicates/is-null.js +1 -1
- package/predicates/is-null.js.map +1 -1
- package/predicates/is-object.js +1 -1
- package/predicates/is-object.js.map +1 -1
- package/predicates/is-primitive.js +4 -4
- package/predicates/is-primitive.js.map +1 -1
- package/predicates/is-undefined.js +1 -1
- package/predicates/is-undefined.js.map +1 -1
- package/promise/delay.js +2 -2
- package/promise/delay.js.map +1 -1
- package/promise/execute-or-resolve-default.js +2 -2
- package/promise/execute-or-resolve-default.js.map +1 -1
- package/promise/execute-with-delay.js +5 -11
- package/promise/execute-with-delay.js.map +1 -1
- package/string/replace-in-template.js +8 -10
- package/string/replace-in-template.js.map +1 -1
package/parsing/parse-enum.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Factory to build enum to parse a string to an enum. Throw error if string is not an enum value
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const createEnumParser = (enumType) => ((value) => {
|
|
5
|
+
const enumValues = Object.values(enumType);
|
|
6
6
|
if (!enumValues.includes(value)) {
|
|
7
7
|
throw new Error('Can\'t parse this value');
|
|
8
8
|
}
|
|
9
9
|
return value;
|
|
10
|
-
});
|
|
10
|
+
});
|
|
11
11
|
|
|
12
12
|
export { createEnumParser };
|
|
13
13
|
//# sourceMappingURL=parse-enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-enum.js","sources":["../../src/parsing/parse-enum.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Factory to build enum to parse a string to an enum. Throw error if string is not an enum value\n */\n export const createEnumParser = <E extends Record<string, Primitive>>(enumType: E) => (\n (value: string) => {\n const enumValues = Object.values(enumType);\n\n if (!enumValues.includes(value as any)) {\n throw new Error('Can\\'t parse this value');\n }\n\n return value as unknown as E;\n }\n);"],"names":[],"mappings":"AAEA;;AAEG;
|
|
1
|
+
{"version":3,"file":"parse-enum.js","sources":["../../src/parsing/parse-enum.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Factory to build enum to parse a string to an enum. Throw error if string is not an enum value\n */\n export const createEnumParser = <E extends Record<string, Primitive>>(enumType: E) => (\n (value: string) => {\n const enumValues = Object.values(enumType);\n\n if (!enumValues.includes(value as any)) {\n throw new Error('Can\\'t parse this value');\n }\n\n return value as unknown as E;\n }\n);"],"names":[],"mappings":"AAEA;;AAEG;AACK,MAAM,gBAAgB,GAAG,CAAsC,QAAW,MAChF,CAAC,KAAa,KAAI;IAChB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAE3C,IAAA,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAY,CAAC,EAAE;AACtC,QAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAC5C,KAAA;AAED,IAAA,OAAO,KAAqB,CAAC;AAC/B,CAAC;;;;"}
|
package/parsing/parse-number.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parse a string to a number. Throw error if string is NaN
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const parseNumber = (value) => {
|
|
5
|
+
const number = parseInt(value, 10);
|
|
6
6
|
if (Number.isNaN(number)) {
|
|
7
7
|
throw new Error('Cannot parse value');
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-number.js","sources":["../../src/parsing/parse-number.ts"],"sourcesContent":["/**\n * Parse a string to a number. Throw error if string is NaN\n */\n export const parseNumber = (value: string): number => {\n const number = parseInt(value, 10);\n\n if (Number.isNaN(number)) {\n throw new Error('Cannot parse value');\n }\n\n return number;\n};"],"names":[],"mappings":"AAAA;;AAEG;
|
|
1
|
+
{"version":3,"file":"parse-number.js","sources":["../../src/parsing/parse-number.ts"],"sourcesContent":["/**\n * Parse a string to a number. Throw error if string is NaN\n */\n export const parseNumber = (value: string): number => {\n const number = parseInt(value, 10);\n\n if (Number.isNaN(number)) {\n throw new Error('Cannot parse value');\n }\n\n return number;\n};"],"names":[],"mappings":"AAAA;;AAEG;AACW,MAAA,WAAW,GAAG,CAAC,KAAa,KAAY;IACpD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAEnC,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxB,QAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACvC,KAAA;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-function.js","sources":["../../src/predicates/is-function.ts"],"sourcesContent":["export const isFunction = (value: any): value is Function => {\n return typeof value === 'function';\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-function.js","sources":["../../src/predicates/is-function.ts"],"sourcesContent":["export const isFunction = (value: any): value is Function => {\n return typeof value === 'function';\n};\n"],"names":[],"mappings":"AAAa,MAAA,UAAU,GAAG,CAAC,KAAU,KAAuB;AAC1D,IAAA,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACrC;;;;"}
|
package/predicates/is-null.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-null.js","sources":["../../src/predicates/is-null.ts"],"sourcesContent":["export const isNull = (value: any): value is null => {\n return value === null;\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-null.js","sources":["../../src/predicates/is-null.ts"],"sourcesContent":["export const isNull = (value: any): value is null => {\n return value === null;\n};\n"],"names":[],"mappings":"AAAa,MAAA,MAAM,GAAG,CAAC,KAAU,KAAmB;IAClD,OAAO,KAAK,KAAK,IAAI,CAAC;AACxB;;;;"}
|
package/predicates/is-object.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-object.js","sources":["../../src/predicates/is-object.ts"],"sourcesContent":["export const isObject = (value: any): value is Object => {\n return typeof value === 'object';\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-object.js","sources":["../../src/predicates/is-object.ts"],"sourcesContent":["export const isObject = (value: any): value is Object => {\n return typeof value === 'object';\n};\n"],"names":[],"mappings":"AAAa,MAAA,QAAQ,GAAG,CAAC,KAAU,KAAqB;AACtD,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC;;;;"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
const PRIMITIVE_TYPES = [
|
|
2
2
|
'string',
|
|
3
3
|
'boolean',
|
|
4
4
|
'number',
|
|
5
5
|
];
|
|
6
|
-
|
|
6
|
+
const isPrimitive = (value) => {
|
|
7
7
|
return PRIMITIVE_TYPES.includes(typeof value);
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
const isArrayOfPrimitive = (value) => {
|
|
10
10
|
if (!Array.isArray(value)) {
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
|
-
return value.every(
|
|
13
|
+
return value.every((arrayValue) => isPrimitive(arrayValue));
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export { isArrayOfPrimitive, isPrimitive };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-primitive.js","sources":["../../src/predicates/is-primitive.ts"],"sourcesContent":["import { Primitive } from '../types/general';\n\nconst PRIMITIVE_TYPES = [\n 'string',\n 'boolean',\n 'number',\n];\n\nexport const isPrimitive = (value: any): value is Primitive => {\n return PRIMITIVE_TYPES.includes(typeof value);\n};\n\nexport const isArrayOfPrimitive = (value: any): value is Array<Primitive> => {\n if (!Array.isArray(value)) {\n return false;\n }\n\n return value.every((arrayValue) => isPrimitive(arrayValue));\n};\n"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"is-primitive.js","sources":["../../src/predicates/is-primitive.ts"],"sourcesContent":["import { Primitive } from '../types/general';\n\nconst PRIMITIVE_TYPES = [\n 'string',\n 'boolean',\n 'number',\n];\n\nexport const isPrimitive = (value: any): value is Primitive => {\n return PRIMITIVE_TYPES.includes(typeof value);\n};\n\nexport const isArrayOfPrimitive = (value: any): value is Array<Primitive> => {\n if (!Array.isArray(value)) {\n return false;\n }\n\n return value.every((arrayValue) => isPrimitive(arrayValue));\n};\n"],"names":[],"mappings":"AAEA,MAAM,eAAe,GAAG;IACtB,QAAQ;IACR,SAAS;IACT,QAAQ;CACT,CAAC;AAEW,MAAA,WAAW,GAAG,CAAC,KAAU,KAAwB;AAC5D,IAAA,OAAO,eAAe,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAChD,EAAE;AAEW,MAAA,kBAAkB,GAAG,CAAC,KAAU,KAA+B;AAC1E,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AAED,IAAA,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,UAAU,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC;AAC9D;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-undefined.js","sources":["../../src/predicates/is-undefined.ts"],"sourcesContent":["export const isUndefined = (value: any): value is undefined => {\n return value === undefined;\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-undefined.js","sources":["../../src/predicates/is-undefined.ts"],"sourcesContent":["export const isUndefined = (value: any): value is undefined => {\n return value === undefined;\n};\n"],"names":[],"mappings":"AAAa,MAAA,WAAW,GAAG,CAAC,KAAU,KAAwB;IAC5D,OAAO,KAAK,KAAK,SAAS,CAAC;AAC7B;;;;"}
|
package/promise/delay.js
CHANGED
package/promise/delay.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delay.js","sources":["../../src/promise/delay.ts"],"sourcesContent":["export const delay = (time: number) => new Promise((resolve) => {\n setTimeout(resolve, time);\n});\n"],"names":[],"mappings":"AAAO,
|
|
1
|
+
{"version":3,"file":"delay.js","sources":["../../src/promise/delay.ts"],"sourcesContent":["export const delay = (time: number) => new Promise((resolve) => {\n setTimeout(resolve, time);\n});\n"],"names":[],"mappings":"AAAO,MAAM,KAAK,GAAG,CAAC,IAAY,KAAK,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;AAC7D,IAAA,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const executeOrResolveDefault = (callback, config) => {
|
|
2
|
+
const { execute, defaultValue } = config;
|
|
3
3
|
if (execute) {
|
|
4
4
|
return callback();
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-or-resolve-default.js","sources":["../../src/promise/execute-or-resolve-default.ts"],"sourcesContent":["export type ExecutionConfig<Default> = {\n execute: boolean,\n defaultValue: Default,\n};\n\nexport const executeOrResolveDefault = <T, Default>(callback: () => Promise<T>, config: ExecutionConfig<Default>): Promise<T | Default> => {\n const { execute, defaultValue } = config;\n\n if (execute) {\n return callback();\n }\n\n return Promise.resolve(defaultValue);\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute-or-resolve-default.js","sources":["../../src/promise/execute-or-resolve-default.ts"],"sourcesContent":["export type ExecutionConfig<Default> = {\n execute: boolean,\n defaultValue: Default,\n};\n\nexport const executeOrResolveDefault = <T, Default>(callback: () => Promise<T>, config: ExecutionConfig<Default>): Promise<T | Default> => {\n const { execute, defaultValue } = config;\n\n if (execute) {\n return callback();\n }\n\n return Promise.resolve(defaultValue);\n};\n"],"names":[],"mappings":"MAKa,uBAAuB,GAAG,CAAa,QAA0B,EAAE,MAAgC,KAA0B;AACxI,IAAA,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;AAEzC,IAAA,IAAI,OAAO,EAAE;QACX,OAAO,QAAQ,EAAE,CAAC;AACnB,KAAA;AAED,IAAA,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACvC;;;;"}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import { __awaiter
|
|
1
|
+
import { __awaiter } from '../_virtual/_tslib.js';
|
|
2
2
|
import { delay } from './delay.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
case 1:
|
|
9
|
-
_a.sent();
|
|
10
|
-
return [2 /*return*/, callback()];
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
}); };
|
|
4
|
+
const executeWithDelay = (callback, time) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5
|
+
yield delay(time);
|
|
6
|
+
return callback();
|
|
7
|
+
});
|
|
14
8
|
|
|
15
9
|
export { executeWithDelay };
|
|
16
10
|
//# sourceMappingURL=execute-with-delay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-with-delay.js","sources":["../../src/promise/execute-with-delay.ts"],"sourcesContent":["import { delay } from './delay';\n\nexport const executeWithDelay = async <T>(callback: () => T, time: number): Promise<T> => {\n await delay(time);\n return callback();\n};\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"execute-with-delay.js","sources":["../../src/promise/execute-with-delay.ts"],"sourcesContent":["import { delay } from './delay';\n\nexport const executeWithDelay = async <T>(callback: () => T, time: number): Promise<T> => {\n await delay(time);\n return callback();\n};\n"],"names":[],"mappings":";;;MAEa,gBAAgB,GAAG,CAAU,QAAiB,EAAE,IAAY,KAAgB,SAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;AACvF,IAAA,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,QAAQ,EAAE,CAAC;AACpB,CAAC;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isPrimitive, isArrayOfPrimitive } from '../predicates/is-primitive.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const defaultConfig = {
|
|
4
4
|
delimiter: {
|
|
5
5
|
left: '{{',
|
|
6
6
|
right: '}}',
|
|
@@ -13,20 +13,18 @@ var defaultConfig = {
|
|
|
13
13
|
*
|
|
14
14
|
* Uses the mustache syntax by default.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var rightDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.right;
|
|
16
|
+
const replaceInTemplate = (template, params, config = defaultConfig) => {
|
|
17
|
+
const { delimiter } = config;
|
|
18
|
+
const leftDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.left;
|
|
19
|
+
const rightDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.right;
|
|
21
20
|
return Object
|
|
22
21
|
.entries(params)
|
|
23
|
-
.reduce(
|
|
24
|
-
var key = _a[0], value = _a[1];
|
|
22
|
+
.reduce((acc, [key, value]) => {
|
|
25
23
|
if (!isPrimitive(value) && !isArrayOfPrimitive(value)) {
|
|
26
24
|
return acc;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
const searchValue = `${leftDelimiter}${key}${rightDelimiter}`;
|
|
27
|
+
const replaceBy = Array.isArray(value) ? value.join(', ') : String(value);
|
|
30
28
|
return acc.replace(searchValue, replaceBy);
|
|
31
29
|
}, template);
|
|
32
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace-in-template.js","sources":["../../src/string/replace-in-template.ts"],"sourcesContent":["import { isArrayOfPrimitive, isPrimitive } from '../predicates';\n\nexport type ReplaceConfig = {\n delimiter: string | {\n left: string,\n right: string,\n },\n};\n\nconst defaultConfig: ReplaceConfig = {\n delimiter: {\n left: '{{',\n right: '}}',\n },\n};\n\n/**\n * Replace string inside a template. For now, only works with\n * an object containing promirives or array of primitives. If\n * it contains other objects, they will be ignored.\n *\n * Uses the mustache syntax by default.\n */\nexport const replaceInTemplate = (\n template: string,\n params: Record<string, any>,\n config: ReplaceConfig = defaultConfig,\n) => {\n const { delimiter } = config;\n const leftDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.left;\n const rightDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.right;\n\n return Object\n .entries(params)\n .reduce((acc, [key, value]) => {\n if (!isPrimitive(value) && !isArrayOfPrimitive(value)) {\n return acc;\n }\n\n const searchValue = `${leftDelimiter}${key}${rightDelimiter}`;\n const replaceBy = Array.isArray(value) ? value.join(', ') : String(value);\n\n return acc.replace(searchValue, replaceBy);\n }, template);\n};\n"],"names":[],"mappings":";;AASA,
|
|
1
|
+
{"version":3,"file":"replace-in-template.js","sources":["../../src/string/replace-in-template.ts"],"sourcesContent":["import { isArrayOfPrimitive, isPrimitive } from '../predicates';\n\nexport type ReplaceConfig = {\n delimiter: string | {\n left: string,\n right: string,\n },\n};\n\nconst defaultConfig: ReplaceConfig = {\n delimiter: {\n left: '{{',\n right: '}}',\n },\n};\n\n/**\n * Replace string inside a template. For now, only works with\n * an object containing promirives or array of primitives. If\n * it contains other objects, they will be ignored.\n *\n * Uses the mustache syntax by default.\n */\nexport const replaceInTemplate = (\n template: string,\n params: Record<string, any>,\n config: ReplaceConfig = defaultConfig,\n) => {\n const { delimiter } = config;\n const leftDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.left;\n const rightDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.right;\n\n return Object\n .entries(params)\n .reduce((acc, [key, value]) => {\n if (!isPrimitive(value) && !isArrayOfPrimitive(value)) {\n return acc;\n }\n\n const searchValue = `${leftDelimiter}${key}${rightDelimiter}`;\n const replaceBy = Array.isArray(value) ? value.join(', ') : String(value);\n\n return acc.replace(searchValue, replaceBy);\n }, template);\n};\n"],"names":[],"mappings":";;AASA,MAAM,aAAa,GAAkB;AACnC,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,KAAK,EAAE,IAAI;AACZ,KAAA;CACF,CAAC;AAEF;;;;;;AAMG;AACI,MAAM,iBAAiB,GAAG,CAC/B,QAAgB,EAChB,MAA2B,EAC3B,MAAA,GAAwB,aAAa,KACnC;AACF,IAAA,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;AAC7B,IAAA,MAAM,aAAa,GAAG,OAAO,SAAS,KAAK,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC;AACjF,IAAA,MAAM,cAAc,GAAG,OAAO,SAAS,KAAK,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC;AAEnF,IAAA,OAAO,MAAM;SACV,OAAO,CAAC,MAAM,CAAC;SACf,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;QAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;AACrD,YAAA,OAAO,GAAG,CAAC;AACZ,SAAA;QAED,MAAM,WAAW,GAAG,CAAG,EAAA,aAAa,GAAG,GAAG,CAAA,EAAG,cAAc,CAAA,CAAE,CAAC;QAC9D,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAE1E,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;KAC5C,EAAE,QAAQ,CAAC,CAAC;AACjB;;;;"}
|