@sparted/shared-library 0.0.13 → 0.0.15

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.
Files changed (105) hide show
  1. package/_virtual/_tslib.js +6 -50
  2. package/_virtual/_tslib.js.map +1 -1
  3. package/array/array-to-map.js +10 -9
  4. package/array/array-to-map.js.map +1 -1
  5. package/array/get-values-from-keys.js +7 -3
  6. package/array/get-values-from-keys.js.map +1 -1
  7. package/array/index.js +11 -2
  8. package/array/index.js.map +1 -1
  9. package/date/constants.js +12 -5
  10. package/date/constants.js.map +1 -1
  11. package/date/convert.js +9 -4
  12. package/date/convert.js.map +1 -1
  13. package/date/format-minutes.js +11 -7
  14. package/date/format-minutes.js.map +1 -1
  15. package/date/get-time-diff-as-string.js +41 -39
  16. package/date/get-time-diff-as-string.js.map +1 -1
  17. package/date/index.js +16 -3
  18. package/date/index.js.map +1 -1
  19. package/formatting/format-number.js +12 -8
  20. package/formatting/format-number.js.map +1 -1
  21. package/formatting/index.js +9 -1
  22. package/formatting/index.js.map +1 -1
  23. package/fp/index.js +9 -1
  24. package/fp/index.js.map +1 -1
  25. package/fp/run-while.js +10 -7
  26. package/fp/run-while.js.map +1 -1
  27. package/http/encode-search-object.js +15 -14
  28. package/http/encode-search-object.js.map +1 -1
  29. package/http/fetch-with-timeout.js +11 -7
  30. package/http/fetch-with-timeout.js.map +1 -1
  31. package/http/index.js +12 -2
  32. package/http/index.js.map +1 -1
  33. package/index.js +67 -27
  34. package/index.js.map +1 -1
  35. package/linked-list/apply-diff-linked-list.js +7 -3
  36. package/linked-list/apply-diff-linked-list.js.map +1 -1
  37. package/linked-list/create-linked-list.js +38 -34
  38. package/linked-list/create-linked-list.js.map +1 -1
  39. package/linked-list/find-linked-list.js +8 -5
  40. package/linked-list/find-linked-list.js.map +1 -1
  41. package/linked-list/get-linked-list.js +6 -2
  42. package/linked-list/get-linked-list.js.map +1 -1
  43. package/linked-list/index.js +9 -1
  44. package/linked-list/index.js.map +1 -1
  45. package/linked-list/insert-linked-list.js +22 -20
  46. package/linked-list/insert-linked-list.js.map +1 -1
  47. package/linked-list/linked-list-utils.js +36 -29
  48. package/linked-list/linked-list-utils.js.map +1 -1
  49. package/linked-list/reduce-linked-list.js +11 -7
  50. package/linked-list/reduce-linked-list.js.map +1 -1
  51. package/linked-list/remove-linked-list.js +19 -16
  52. package/linked-list/remove-linked-list.js.map +1 -1
  53. package/linked-list/update-linked-list.js +13 -10
  54. package/linked-list/update-linked-list.js.map +1 -1
  55. package/linked-list/while-linked-list.js +10 -7
  56. package/linked-list/while-linked-list.js.map +1 -1
  57. package/math/clamp-number.js +8 -5
  58. package/math/clamp-number.js.map +1 -1
  59. package/math/index.js +16 -4
  60. package/math/index.js.map +1 -1
  61. package/math/interpolate.js +11 -7
  62. package/math/interpolate.js.map +1 -1
  63. package/math/number-range.js +9 -5
  64. package/math/number-range.js.map +1 -1
  65. package/math/random-number.js +8 -5
  66. package/math/random-number.js.map +1 -1
  67. package/object/index.js +9 -1
  68. package/object/index.js.map +1 -1
  69. package/object/merge-deep.js +10 -9
  70. package/object/merge-deep.js.map +1 -1
  71. package/package.json +1 -1
  72. package/parsing/index.js +13 -3
  73. package/parsing/index.js.map +1 -1
  74. package/parsing/parse-boolean.js +6 -2
  75. package/parsing/parse-boolean.js.map +1 -1
  76. package/parsing/parse-enum.js +8 -4
  77. package/parsing/parse-enum.js.map +1 -1
  78. package/parsing/parse-number.js +7 -3
  79. package/parsing/parse-number.js.map +1 -1
  80. package/predicates/index.js +18 -5
  81. package/predicates/index.js.map +1 -1
  82. package/predicates/is-function.js +6 -2
  83. package/predicates/is-function.js.map +1 -1
  84. package/predicates/is-null.js +6 -2
  85. package/predicates/is-null.js.map +1 -1
  86. package/predicates/is-object.js +6 -2
  87. package/predicates/is-object.js.map +1 -1
  88. package/predicates/is-primitive.js +10 -5
  89. package/predicates/is-primitive.js.map +1 -1
  90. package/predicates/is-undefined.js +6 -2
  91. package/predicates/is-undefined.js.map +1 -1
  92. package/promise/delay.js +7 -3
  93. package/promise/delay.js.map +1 -1
  94. package/promise/execute-or-resolve-default.js +7 -3
  95. package/promise/execute-or-resolve-default.js.map +1 -1
  96. package/promise/execute-with-delay.js +11 -13
  97. package/promise/execute-with-delay.js.map +1 -1
  98. package/promise/index.js +13 -3
  99. package/promise/index.js.map +1 -1
  100. package/string/index.js +9 -1
  101. package/string/index.js.map +1 -1
  102. package/string/replace-in-template.js +15 -13
  103. package/string/replace-in-template.js.map +1 -1
  104. package/types/index.js +1 -0
  105. package/types/index.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -1,12 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
1
5
  /**
2
6
  * Parse a string to a boolean. Throw error if string is neither "true" nor "false"
3
7
  */
4
- var parseBoolean = function (value) {
8
+ const parseBoolean = (value) => {
5
9
  if (value !== 'true' && value !== 'false') {
6
10
  throw new Error('Cannot parse value');
7
11
  }
8
12
  return value === 'true';
9
13
  };
10
14
 
11
- export { parseBoolean };
15
+ exports.parseBoolean = parseBoolean;
12
16
  //# sourceMappingURL=parse-boolean.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-boolean.js","sources":["../../src/parsing/parse-boolean.ts"],"sourcesContent":["/**\n * Parse a string to a boolean. Throw error if string is neither \"true\" nor \"false\"\n */\n export const parseBoolean = (value: string): boolean => {\n if (value !== 'true' && value !== 'false') {\n throw new Error('Cannot parse value');\n }\n\n return value === 'true';\n};\n"],"names":[],"mappings":"AAAA;;AAEG;AACK,IAAM,YAAY,GAAG,UAAC,KAAa,EAAA;AACzC,IAAA,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,EAAE;AACzC,QAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACvC,KAAA;IAED,OAAO,KAAK,KAAK,MAAM,CAAC;AAC1B;;;;"}
1
+ {"version":3,"file":"parse-boolean.js","sources":["../../src/parsing/parse-boolean.ts"],"sourcesContent":["/**\n * Parse a string to a boolean. Throw error if string is neither \"true\" nor \"false\"\n */\n export const parseBoolean = (value: string): boolean => {\n if (value !== 'true' && value !== 'false') {\n throw new Error('Cannot parse value');\n }\n\n return value === 'true';\n};\n"],"names":[],"mappings":";;;;AAAA;;AAEG;AACW,MAAA,YAAY,GAAG,CAAC,KAAa,KAAa;AACtD,IAAA,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,EAAE;AACzC,QAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACvC,KAAA;IAED,OAAO,KAAK,KAAK,MAAM,CAAC;AAC1B;;;;"}
@@ -1,13 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
1
5
  /**
2
6
  * Factory to build enum to parse a string to an enum. Throw error if string is not an enum value
3
7
  */
4
- var createEnumParser = function (enumType) { return (function (value) {
5
- var enumValues = Object.values(enumType);
8
+ const createEnumParser = (enumType) => ((value) => {
9
+ const enumValues = Object.values(enumType);
6
10
  if (!enumValues.includes(value)) {
7
11
  throw new Error('Can\'t parse this value');
8
12
  }
9
13
  return value;
10
- }); };
14
+ });
11
15
 
12
- export { createEnumParser };
16
+ exports.createEnumParser = createEnumParser;
13
17
  //# 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;AACW,IAAA,gBAAgB,GAAG,UAAsC,QAAW,EAAK,EAAA,QACrF,UAAC,KAAa,EAAA;IACZ,IAAM,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,EAToF;;;;"}
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;;;;"}
@@ -1,13 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
1
5
  /**
2
6
  * Parse a string to a number. Throw error if string is NaN
3
7
  */
4
- var parseNumber = function (value) {
5
- var number = parseInt(value, 10);
8
+ const parseNumber = (value) => {
9
+ const number = parseInt(value, 10);
6
10
  if (Number.isNaN(number)) {
7
11
  throw new Error('Cannot parse value');
8
12
  }
9
13
  return number;
10
14
  };
11
15
 
12
- export { parseNumber };
16
+ exports.parseNumber = parseNumber;
13
17
  //# sourceMappingURL=parse-number.js.map
@@ -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;AACK,IAAM,WAAW,GAAG,UAAC,KAAa,EAAA;IACxC,IAAM,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
+ {"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,6 +1,19 @@
1
- export { isFunction } from './is-function.js';
2
- export { isNull } from './is-null.js';
3
- export { isObject } from './is-object.js';
4
- export { isArrayOfPrimitive, isPrimitive } from './is-primitive.js';
5
- export { isUndefined } from './is-undefined.js';
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var isFunction = require('./is-function.js');
6
+ var isNull = require('./is-null.js');
7
+ var isObject = require('./is-object.js');
8
+ var isPrimitive = require('./is-primitive.js');
9
+ var isUndefined = require('./is-undefined.js');
10
+
11
+
12
+
13
+ exports.isFunction = isFunction.isFunction;
14
+ exports.isNull = isNull.isNull;
15
+ exports.isObject = isObject.isObject;
16
+ exports.isArrayOfPrimitive = isPrimitive.isArrayOfPrimitive;
17
+ exports.isPrimitive = isPrimitive.isPrimitive;
18
+ exports.isUndefined = isUndefined.isUndefined;
6
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,10 @@
1
- var isFunction = function (value) {
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const isFunction = (value) => {
2
6
  return typeof value === 'function';
3
7
  };
4
8
 
5
- export { isFunction };
9
+ exports.isFunction = isFunction;
6
10
  //# sourceMappingURL=is-function.js.map
@@ -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":"AAAO,IAAM,UAAU,GAAG,UAAC,KAAU,EAAA;AACnC,IAAA,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACrC;;;;"}
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;;;;"}
@@ -1,6 +1,10 @@
1
- var isNull = function (value) {
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const isNull = (value) => {
2
6
  return value === null;
3
7
  };
4
8
 
5
- export { isNull };
9
+ exports.isNull = isNull;
6
10
  //# sourceMappingURL=is-null.js.map
@@ -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":"AAAO,IAAM,MAAM,GAAG,UAAC,KAAU,EAAA;IAC/B,OAAO,KAAK,KAAK,IAAI,CAAC;AACxB;;;;"}
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;;;;"}
@@ -1,6 +1,10 @@
1
- var isObject = function (value) {
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const isObject = (value) => {
2
6
  return typeof value === 'object';
3
7
  };
4
8
 
5
- export { isObject };
9
+ exports.isObject = isObject;
6
10
  //# sourceMappingURL=is-object.js.map
@@ -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":"AAAO,IAAM,QAAQ,GAAG,UAAC,KAAU,EAAA;AACjC,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC;;;;"}
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,17 +1,22 @@
1
- var PRIMITIVE_TYPES = [
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const PRIMITIVE_TYPES = [
2
6
  'string',
3
7
  'boolean',
4
8
  'number',
5
9
  ];
6
- var isPrimitive = function (value) {
10
+ const isPrimitive = (value) => {
7
11
  return PRIMITIVE_TYPES.includes(typeof value);
8
12
  };
9
- var isArrayOfPrimitive = function (value) {
13
+ const isArrayOfPrimitive = (value) => {
10
14
  if (!Array.isArray(value)) {
11
15
  return false;
12
16
  }
13
- return value.every(function (arrayValue) { return isPrimitive(arrayValue); });
17
+ return value.every((arrayValue) => isPrimitive(arrayValue));
14
18
  };
15
19
 
16
- export { isArrayOfPrimitive, isPrimitive };
20
+ exports.isArrayOfPrimitive = isArrayOfPrimitive;
21
+ exports.isPrimitive = isPrimitive;
17
22
  //# sourceMappingURL=is-primitive.js.map
@@ -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,IAAM,eAAe,GAAG;IACtB,QAAQ;IACR,SAAS;IACT,QAAQ;CACT,CAAC;AAEK,IAAM,WAAW,GAAG,UAAC,KAAU,EAAA;AACpC,IAAA,OAAO,eAAe,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAChD,EAAE;AAEK,IAAM,kBAAkB,GAAG,UAAC,KAAU,EAAA;AAC3C,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AAED,IAAA,OAAO,KAAK,CAAC,KAAK,CAAC,UAAC,UAAU,EAAA,EAAK,OAAA,WAAW,CAAC,UAAU,CAAC,CAAvB,EAAuB,CAAC,CAAC;AAC9D;;;;"}
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,6 +1,10 @@
1
- var isUndefined = function (value) {
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const isUndefined = (value) => {
2
6
  return value === undefined;
3
7
  };
4
8
 
5
- export { isUndefined };
9
+ exports.isUndefined = isUndefined;
6
10
  //# sourceMappingURL=is-undefined.js.map
@@ -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":"AAAO,IAAM,WAAW,GAAG,UAAC,KAAU,EAAA;IACpC,OAAO,KAAK,KAAK,SAAS,CAAC;AAC7B;;;;"}
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
@@ -1,6 +1,10 @@
1
- var delay = function (time) { return new Promise(function (resolve) {
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const delay = (time) => new Promise((resolve) => {
2
6
  setTimeout(resolve, time);
3
- }); };
7
+ });
4
8
 
5
- export { delay };
9
+ exports.delay = delay;
6
10
  //# sourceMappingURL=delay.js.map
@@ -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,IAAM,KAAK,GAAG,UAAC,IAAY,EAAK,EAAA,OAAA,IAAI,OAAO,CAAC,UAAC,OAAO,EAAA;AACzD,IAAA,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAC,CAFqC;;;;"}
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,10 +1,14 @@
1
- var executeOrResolveDefault = function (callback, config) {
2
- var execute = config.execute, defaultValue = config.defaultValue;
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const executeOrResolveDefault = (callback, config) => {
6
+ const { execute, defaultValue } = config;
3
7
  if (execute) {
4
8
  return callback();
5
9
  }
6
10
  return Promise.resolve(defaultValue);
7
11
  };
8
12
 
9
- export { executeOrResolveDefault };
13
+ exports.executeOrResolveDefault = executeOrResolveDefault;
10
14
  //# sourceMappingURL=execute-or-resolve-default.js.map
@@ -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":"AAKa,IAAA,uBAAuB,GAAG,UAAa,QAA0B,EAAE,MAAgC,EAAA;IACtG,IAAA,OAAO,GAAmB,MAAM,CAAA,OAAzB,EAAE,YAAY,GAAK,MAAM,CAAA,YAAX,CAAY;AAEzC,IAAA,IAAI,OAAO,EAAE;QACX,OAAO,QAAQ,EAAE,CAAC;AACnB,KAAA;AAED,IAAA,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACvC;;;;"}
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,14 @@
1
- import { __awaiter, __generator } from '../_virtual/_tslib.js';
2
- import { delay } from './delay.js';
1
+ 'use strict';
3
2
 
4
- var executeWithDelay = function (callback, time) { return __awaiter(void 0, void 0, void 0, function () {
5
- return __generator(this, function (_a) {
6
- switch (_a.label) {
7
- case 0: return [4 /*yield*/, delay(time)];
8
- case 1:
9
- _a.sent();
10
- return [2 /*return*/, callback()];
11
- }
12
- });
13
- }); };
3
+ Object.defineProperty(exports, '__esModule', { value: true });
14
4
 
15
- export { executeWithDelay };
5
+ var _tslib = require('../_virtual/_tslib.js');
6
+ var delay = require('./delay.js');
7
+
8
+ const executeWithDelay = (callback, time) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
9
+ yield delay.delay(time);
10
+ return callback();
11
+ });
12
+
13
+ exports.executeWithDelay = executeWithDelay;
16
14
  //# 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":";;;AAEa,IAAA,gBAAgB,GAAG,UAAU,QAAiB,EAAE,IAAY,EAAA,EAAA,OAAA,SAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,YAAA;;;AACvE,YAAA,KAAA,CAAA,EAAA,OAAA,CAAA,CAAA,YAAM,KAAK,CAAC,IAAI,CAAC,CAAA,CAAA;;AAAjB,gBAAA,EAAA,CAAA,IAAA,EAAiB,CAAC;gBAClB,OAAO,CAAA,CAAA,aAAA,QAAQ,EAAE,CAAC,CAAA;;;;;;;"}
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":["__awaiter","delay"],"mappings":";;;;;;;MAEa,gBAAgB,GAAG,CAAU,QAAiB,EAAE,IAAY,KAAgBA,gBAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;AACvF,IAAA,MAAMC,WAAK,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,QAAQ,EAAE,CAAC;AACpB,CAAC;;;;"}
package/promise/index.js CHANGED
@@ -1,4 +1,14 @@
1
- export { executeOrResolveDefault } from './execute-or-resolve-default.js';
2
- export { executeWithDelay } from './execute-with-delay.js';
3
- export { delay } from './delay.js';
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var executeOrResolveDefault = require('./execute-or-resolve-default.js');
6
+ var executeWithDelay = require('./execute-with-delay.js');
7
+ var delay = require('./delay.js');
8
+
9
+
10
+
11
+ exports.executeOrResolveDefault = executeOrResolveDefault.executeOrResolveDefault;
12
+ exports.executeWithDelay = executeWithDelay.executeWithDelay;
13
+ exports.delay = delay.delay;
4
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
package/string/index.js CHANGED
@@ -1,2 +1,10 @@
1
- export { replaceInTemplate } from './replace-in-template.js';
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var replaceInTemplate = require('./replace-in-template.js');
6
+
7
+
8
+
9
+ exports.replaceInTemplate = replaceInTemplate.replaceInTemplate;
2
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,6 +1,10 @@
1
- import { isPrimitive, isArrayOfPrimitive } from '../predicates/is-primitive.js';
1
+ 'use strict';
2
2
 
3
- var defaultConfig = {
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var isPrimitive = require('../predicates/is-primitive.js');
6
+
7
+ const defaultConfig = {
4
8
  delimiter: {
5
9
  left: '{{',
6
10
  right: '}}',
@@ -13,23 +17,21 @@ var defaultConfig = {
13
17
  *
14
18
  * Uses the mustache syntax by default.
15
19
  */
16
- var replaceInTemplate = function (template, params, config) {
17
- if (config === void 0) { config = defaultConfig; }
18
- var delimiter = config.delimiter;
19
- var leftDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.left;
20
- var rightDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.right;
20
+ const replaceInTemplate = (template, params, config = defaultConfig) => {
21
+ const { delimiter } = config;
22
+ const leftDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.left;
23
+ const rightDelimiter = typeof delimiter === 'string' ? delimiter : delimiter.right;
21
24
  return Object
22
25
  .entries(params)
23
- .reduce(function (acc, _a) {
24
- var key = _a[0], value = _a[1];
25
- if (!isPrimitive(value) && !isArrayOfPrimitive(value)) {
26
+ .reduce((acc, [key, value]) => {
27
+ if (!isPrimitive.isPrimitive(value) && !isPrimitive.isArrayOfPrimitive(value)) {
26
28
  return acc;
27
29
  }
28
- var searchValue = "".concat(leftDelimiter).concat(key).concat(rightDelimiter);
29
- var replaceBy = Array.isArray(value) ? value.join(', ') : String(value);
30
+ const searchValue = `${leftDelimiter}${key}${rightDelimiter}`;
31
+ const replaceBy = Array.isArray(value) ? value.join(', ') : String(value);
30
32
  return acc.replace(searchValue, replaceBy);
31
33
  }, template);
32
34
  };
33
35
 
34
- export { replaceInTemplate };
36
+ exports.replaceInTemplate = replaceInTemplate;
35
37
  //# sourceMappingURL=replace-in-template.js.map
@@ -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,IAAM,aAAa,GAAkB;AACnC,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,KAAK,EAAE,IAAI;AACZ,KAAA;CACF,CAAC;AAEF;;;;;;AAMG;IACU,iBAAiB,GAAG,UAC/B,QAAgB,EAChB,MAA2B,EAC3B,MAAqC,EAAA;AAArC,IAAA,IAAA,MAAA,KAAA,KAAA,CAAA,EAAA,EAAA,MAAqC,GAAA,aAAA,CAAA,EAAA;AAE7B,IAAA,IAAA,SAAS,GAAK,MAAM,CAAA,SAAX,CAAY;AAC7B,IAAA,IAAM,aAAa,GAAG,OAAO,SAAS,KAAK,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC;AACjF,IAAA,IAAM,cAAc,GAAG,OAAO,SAAS,KAAK,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC;AAEnF,IAAA,OAAO,MAAM;SACV,OAAO,CAAC,MAAM,CAAC;AACf,SAAA,MAAM,CAAC,UAAC,GAAG,EAAE,EAAY,EAAA;YAAX,GAAG,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,KAAK,GAAA,EAAA,CAAA,CAAA,CAAA,CAAA;QACvB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;AACrD,YAAA,OAAO,GAAG,CAAC;AACZ,SAAA;QAED,IAAM,WAAW,GAAG,EAAG,CAAA,MAAA,CAAA,aAAa,SAAG,GAAG,CAAA,CAAA,MAAA,CAAG,cAAc,CAAE,CAAC;QAC9D,IAAM,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;;;;"}
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":["isPrimitive","isArrayOfPrimitive"],"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,CAACA,uBAAW,CAAC,KAAK,CAAC,IAAI,CAACC,8BAAkB,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;;;;"}
package/types/index.js CHANGED
@@ -1,2 +1,3 @@
1
+ 'use strict';
1
2
 
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}