@spscommerce/utils 5.20.3-ie → 5.20.5

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 (209) hide show
  1. package/lib/index.cjs.js +1 -2437
  2. package/lib/index.es.js +893 -2268
  3. package/package.json +5 -5
  4. package/vite.config.js +1 -1
  5. package/dist/out-tsc/array/flatten.d.ts +0 -1
  6. package/dist/out-tsc/array/flatten.js +0 -7
  7. package/dist/out-tsc/array/flatten.js.map +0 -1
  8. package/dist/out-tsc/array/flatten.spec.d.ts +0 -1
  9. package/dist/out-tsc/array/flatten.spec.js +0 -10
  10. package/dist/out-tsc/array/flatten.spec.js.map +0 -1
  11. package/dist/out-tsc/array/index.d.ts +0 -3
  12. package/dist/out-tsc/array/index.js +0 -4
  13. package/dist/out-tsc/array/index.js.map +0 -1
  14. package/dist/out-tsc/array/is-subset.d.ts +0 -4
  15. package/dist/out-tsc/array/is-subset.js +0 -41
  16. package/dist/out-tsc/array/is-subset.js.map +0 -1
  17. package/dist/out-tsc/array/is-subset.spec.d.ts +0 -1
  18. package/dist/out-tsc/array/is-subset.spec.js +0 -41
  19. package/dist/out-tsc/array/is-subset.spec.js.map +0 -1
  20. package/dist/out-tsc/array/range.d.ts +0 -5
  21. package/dist/out-tsc/array/range.js +0 -16
  22. package/dist/out-tsc/array/range.js.map +0 -1
  23. package/dist/out-tsc/array/range.spec.d.ts +0 -1
  24. package/dist/out-tsc/array/range.spec.js +0 -26
  25. package/dist/out-tsc/array/range.spec.js.map +0 -1
  26. package/dist/out-tsc/classes/custom-event.d.ts +0 -4
  27. package/dist/out-tsc/classes/custom-event.js +0 -87
  28. package/dist/out-tsc/classes/custom-event.js.map +0 -1
  29. package/dist/out-tsc/classes/index.d.ts +0 -1
  30. package/dist/out-tsc/classes/index.js +0 -2
  31. package/dist/out-tsc/classes/index.js.map +0 -1
  32. package/dist/out-tsc/data/doctypes.d.ts +0 -4
  33. package/dist/out-tsc/data/doctypes.js +0 -302
  34. package/dist/out-tsc/data/doctypes.js.map +0 -1
  35. package/dist/out-tsc/data/index.d.ts +0 -1
  36. package/dist/out-tsc/data/index.js +0 -2
  37. package/dist/out-tsc/data/index.js.map +0 -1
  38. package/dist/out-tsc/decorators/cast-to-number.d.ts +0 -5
  39. package/dist/out-tsc/decorators/cast-to-number.js +0 -29
  40. package/dist/out-tsc/decorators/cast-to-number.js.map +0 -1
  41. package/dist/out-tsc/decorators/debounced.broken_spec.d.ts +0 -0
  42. package/dist/out-tsc/decorators/debounced.broken_spec.js +0 -38
  43. package/dist/out-tsc/decorators/debounced.broken_spec.js.map +0 -1
  44. package/dist/out-tsc/decorators/debounced.d.ts +0 -11
  45. package/dist/out-tsc/decorators/debounced.js +0 -35
  46. package/dist/out-tsc/decorators/debounced.js.map +0 -1
  47. package/dist/out-tsc/decorators/index.d.ts +0 -5
  48. package/dist/out-tsc/decorators/index.js +0 -6
  49. package/dist/out-tsc/decorators/index.js.map +0 -1
  50. package/dist/out-tsc/decorators/locked-to-animation-frames.d.ts +0 -4
  51. package/dist/out-tsc/decorators/locked-to-animation-frames.js +0 -34
  52. package/dist/out-tsc/decorators/locked-to-animation-frames.js.map +0 -1
  53. package/dist/out-tsc/decorators/locked-to-animation-frames.spec.d.ts +0 -0
  54. package/dist/out-tsc/decorators/locked-to-animation-frames.spec.js +0 -63
  55. package/dist/out-tsc/decorators/locked-to-animation-frames.spec.js.map +0 -1
  56. package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.d.ts +0 -11
  57. package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.js +0 -80
  58. package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.js.map +0 -1
  59. package/dist/out-tsc/decorators/tick-delay.d.ts +0 -6
  60. package/dist/out-tsc/decorators/tick-delay.js +0 -31
  61. package/dist/out-tsc/decorators/tick-delay.js.map +0 -1
  62. package/dist/out-tsc/function/debounce.d.ts +0 -9
  63. package/dist/out-tsc/function/debounce.js +0 -102
  64. package/dist/out-tsc/function/debounce.js.map +0 -1
  65. package/dist/out-tsc/function/debounce.spec.d.ts +0 -1
  66. package/dist/out-tsc/function/debounce.spec.js +0 -150
  67. package/dist/out-tsc/function/debounce.spec.js.map +0 -1
  68. package/dist/out-tsc/function/debounced-function.interface.d.ts +0 -10
  69. package/dist/out-tsc/function/debounced-function.interface.js +0 -2
  70. package/dist/out-tsc/function/debounced-function.interface.js.map +0 -1
  71. package/dist/out-tsc/function/delayed-function.interface.d.ts +0 -10
  72. package/dist/out-tsc/function/delayed-function.interface.js +0 -2
  73. package/dist/out-tsc/function/delayed-function.interface.js.map +0 -1
  74. package/dist/out-tsc/function/index.d.ts +0 -6
  75. package/dist/out-tsc/function/index.js +0 -7
  76. package/dist/out-tsc/function/index.js.map +0 -1
  77. package/dist/out-tsc/function/lock-to-animation-frames.d.ts +0 -7
  78. package/dist/out-tsc/function/lock-to-animation-frames.js +0 -43
  79. package/dist/out-tsc/function/lock-to-animation-frames.js.map +0 -1
  80. package/dist/out-tsc/function/lock-to-animation-frames.spec.d.ts +0 -0
  81. package/dist/out-tsc/function/lock-to-animation-frames.spec.js +0 -53
  82. package/dist/out-tsc/function/lock-to-animation-frames.spec.js.map +0 -1
  83. package/dist/out-tsc/function/on-next-tick.d.ts +0 -8
  84. package/dist/out-tsc/function/on-next-tick.js +0 -12
  85. package/dist/out-tsc/function/on-next-tick.js.map +0 -1
  86. package/dist/out-tsc/function/on-next-tick.spec.d.ts +0 -1
  87. package/dist/out-tsc/function/on-next-tick.spec.js +0 -13
  88. package/dist/out-tsc/function/on-next-tick.spec.js.map +0 -1
  89. package/dist/out-tsc/function/op.d.ts +0 -32
  90. package/dist/out-tsc/function/op.js +0 -34
  91. package/dist/out-tsc/function/op.js.map +0 -1
  92. package/dist/out-tsc/function/op.spec.d.ts +0 -1
  93. package/dist/out-tsc/function/op.spec.js +0 -94
  94. package/dist/out-tsc/function/op.spec.js.map +0 -1
  95. package/dist/out-tsc/index.d.ts +0 -9
  96. package/dist/out-tsc/index.js +0 -10
  97. package/dist/out-tsc/index.js.map +0 -1
  98. package/dist/out-tsc/number/constrain.d.ts +0 -7
  99. package/dist/out-tsc/number/constrain.js +0 -16
  100. package/dist/out-tsc/number/constrain.js.map +0 -1
  101. package/dist/out-tsc/number/decimal-round.d.ts +0 -7
  102. package/dist/out-tsc/number/decimal-round.js +0 -19
  103. package/dist/out-tsc/number/decimal-round.js.map +0 -1
  104. package/dist/out-tsc/number/decimal-round.spec.d.ts +0 -1
  105. package/dist/out-tsc/number/decimal-round.spec.js +0 -10
  106. package/dist/out-tsc/number/decimal-round.spec.js.map +0 -1
  107. package/dist/out-tsc/number/index.d.ts +0 -3
  108. package/dist/out-tsc/number/index.js +0 -4
  109. package/dist/out-tsc/number/index.js.map +0 -1
  110. package/dist/out-tsc/number/to-file-size-string.d.ts +0 -5
  111. package/dist/out-tsc/number/to-file-size-string.js +0 -24
  112. package/dist/out-tsc/number/to-file-size-string.js.map +0 -1
  113. package/dist/out-tsc/object/copy-property.d.ts +0 -6
  114. package/dist/out-tsc/object/copy-property.js +0 -9
  115. package/dist/out-tsc/object/copy-property.js.map +0 -1
  116. package/dist/out-tsc/object/copy-property.spec.d.ts +0 -1
  117. package/dist/out-tsc/object/copy-property.spec.js +0 -16
  118. package/dist/out-tsc/object/copy-property.spec.js.map +0 -1
  119. package/dist/out-tsc/object/crumble-path.d.ts +0 -6
  120. package/dist/out-tsc/object/crumble-path.js +0 -9
  121. package/dist/out-tsc/object/crumble-path.js.map +0 -1
  122. package/dist/out-tsc/object/crumble-path.spec.d.ts +0 -1
  123. package/dist/out-tsc/object/crumble-path.spec.js +0 -24
  124. package/dist/out-tsc/object/crumble-path.spec.js.map +0 -1
  125. package/dist/out-tsc/object/deep-freeze.d.ts +0 -1
  126. package/dist/out-tsc/object/deep-freeze.js +0 -36
  127. package/dist/out-tsc/object/deep-freeze.js.map +0 -1
  128. package/dist/out-tsc/object/deep-freeze.spec.d.ts +0 -1
  129. package/dist/out-tsc/object/deep-freeze.spec.js +0 -14
  130. package/dist/out-tsc/object/deep-freeze.spec.js.map +0 -1
  131. package/dist/out-tsc/object/diff.d.ts +0 -12
  132. package/dist/out-tsc/object/diff.js +0 -92
  133. package/dist/out-tsc/object/diff.js.map +0 -1
  134. package/dist/out-tsc/object/diff.spec.d.ts +0 -1
  135. package/dist/out-tsc/object/diff.spec.js +0 -40
  136. package/dist/out-tsc/object/diff.spec.js.map +0 -1
  137. package/dist/out-tsc/object/for-each-entry-deep.d.ts +0 -4
  138. package/dist/out-tsc/object/for-each-entry-deep.js +0 -38
  139. package/dist/out-tsc/object/for-each-entry-deep.js.map +0 -1
  140. package/dist/out-tsc/object/for-each-entry-deep.spec.d.ts +0 -1
  141. package/dist/out-tsc/object/for-each-entry-deep.spec.js +0 -24
  142. package/dist/out-tsc/object/for-each-entry-deep.spec.js.map +0 -1
  143. package/dist/out-tsc/object/for-each-nested-object.d.ts +0 -4
  144. package/dist/out-tsc/object/for-each-nested-object.js +0 -38
  145. package/dist/out-tsc/object/for-each-nested-object.js.map +0 -1
  146. package/dist/out-tsc/object/for-each-nested-object.spec.d.ts +0 -1
  147. package/dist/out-tsc/object/for-each-nested-object.spec.js +0 -46
  148. package/dist/out-tsc/object/for-each-nested-object.spec.js.map +0 -1
  149. package/dist/out-tsc/object/get-path.d.ts +0 -5
  150. package/dist/out-tsc/object/get-path.js +0 -67
  151. package/dist/out-tsc/object/get-path.js.map +0 -1
  152. package/dist/out-tsc/object/get-path.spec.d.ts +0 -1
  153. package/dist/out-tsc/object/get-path.spec.js +0 -44
  154. package/dist/out-tsc/object/get-path.spec.js.map +0 -1
  155. package/dist/out-tsc/object/index.d.ts +0 -13
  156. package/dist/out-tsc/object/index.js +0 -14
  157. package/dist/out-tsc/object/index.js.map +0 -1
  158. package/dist/out-tsc/object/merge-deep.d.ts +0 -4
  159. package/dist/out-tsc/object/merge-deep.js +0 -60
  160. package/dist/out-tsc/object/merge-deep.js.map +0 -1
  161. package/dist/out-tsc/object/merge-deep.spec.d.ts +0 -1
  162. package/dist/out-tsc/object/merge-deep.spec.js +0 -16
  163. package/dist/out-tsc/object/merge-deep.spec.js.map +0 -1
  164. package/dist/out-tsc/object/merge-properties-deep.d.ts +0 -4
  165. package/dist/out-tsc/object/merge-properties-deep.js +0 -61
  166. package/dist/out-tsc/object/merge-properties-deep.js.map +0 -1
  167. package/dist/out-tsc/object/merge-properties-deep.spec.d.ts +0 -1
  168. package/dist/out-tsc/object/merge-properties-deep.spec.js +0 -24
  169. package/dist/out-tsc/object/merge-properties-deep.spec.js.map +0 -1
  170. package/dist/out-tsc/object/omit.d.ts +0 -1
  171. package/dist/out-tsc/object/omit.js +0 -40
  172. package/dist/out-tsc/object/omit.js.map +0 -1
  173. package/dist/out-tsc/object/omit.spec.d.ts +0 -1
  174. package/dist/out-tsc/object/omit.spec.js +0 -10
  175. package/dist/out-tsc/object/omit.spec.js.map +0 -1
  176. package/dist/out-tsc/object/set-path.d.ts +0 -2
  177. package/dist/out-tsc/object/set-path.js +0 -45
  178. package/dist/out-tsc/object/set-path.js.map +0 -1
  179. package/dist/out-tsc/object/set-path.spec.d.ts +0 -1
  180. package/dist/out-tsc/object/set-path.spec.js +0 -36
  181. package/dist/out-tsc/object/set-path.spec.js.map +0 -1
  182. package/dist/out-tsc/object/traverse-path.d.ts +0 -2
  183. package/dist/out-tsc/object/traverse-path.js +0 -81
  184. package/dist/out-tsc/object/traverse-path.js.map +0 -1
  185. package/dist/out-tsc/object/values.d.ts +0 -2
  186. package/dist/out-tsc/object/values.js +0 -31
  187. package/dist/out-tsc/object/values.js.map +0 -1
  188. package/dist/out-tsc/object/values.spec.d.ts +0 -1
  189. package/dist/out-tsc/object/values.spec.js +0 -7
  190. package/dist/out-tsc/object/values.spec.js.map +0 -1
  191. package/dist/out-tsc/string/code.template-tag.d.ts +0 -2
  192. package/dist/out-tsc/string/code.template-tag.js +0 -38
  193. package/dist/out-tsc/string/code.template-tag.js.map +0 -1
  194. package/dist/out-tsc/string/index.d.ts +0 -3
  195. package/dist/out-tsc/string/index.js +0 -4
  196. package/dist/out-tsc/string/index.js.map +0 -1
  197. package/dist/out-tsc/string/parse-file-size.d.ts +0 -5
  198. package/dist/out-tsc/string/parse-file-size.js +0 -43
  199. package/dist/out-tsc/string/parse-file-size.js.map +0 -1
  200. package/dist/out-tsc/string/template.d.ts +0 -15
  201. package/dist/out-tsc/string/template.js +0 -28
  202. package/dist/out-tsc/string/template.js.map +0 -1
  203. package/dist/out-tsc/string/template.spec.d.ts +0 -1
  204. package/dist/out-tsc/string/template.spec.js +0 -39
  205. package/dist/out-tsc/string/template.spec.js.map +0 -1
  206. package/dist/out-tsc/typings.d.ts +0 -1
  207. package/dist/out-tsc/typings.js +0 -2
  208. package/dist/out-tsc/typings.js.map +0 -1
  209. package/rollup.config.js +0 -22
@@ -1,40 +0,0 @@
1
- var __values = (this && this.__values) || function(o) {
2
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
- if (m) return m.call(o);
4
- if (o && typeof o.length === "number") return {
5
- next: function () {
6
- if (o && i >= o.length) o = void 0;
7
- return { value: o && o[i++], done: !o };
8
- }
9
- };
10
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
- };
12
- /*
13
- * Return a copy of `obj` without the key `key`
14
- */
15
- export function omit(obj) {
16
- var e_1, _a;
17
- var keys = [];
18
- for (var _i = 1; _i < arguments.length; _i++) {
19
- keys[_i - 1] = arguments[_i];
20
- }
21
- var keySet = new Set(keys);
22
- var result = {};
23
- try {
24
- for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) {
25
- var k = _c.value;
26
- if (!keySet.has(k)) {
27
- result[k] = obj[k];
28
- }
29
- }
30
- }
31
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
32
- finally {
33
- try {
34
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
35
- }
36
- finally { if (e_1) throw e_1.error; }
37
- }
38
- return result;
39
- }
40
- //# sourceMappingURL=omit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"omit.js","sourceRoot":"","sources":["../../../src/object/omit.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;;GAEG;AACH,MAAM,UAAU,IAAI,CAAC,GAAG;;IAAE,cAAsB;SAAtB,UAAsB,EAAtB,qBAAsB,EAAtB,IAAsB;QAAtB,6BAAsB;;IAC9C,IAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAM,MAAM,GAAG,EAAE,CAAC;;QAClB,KAAgB,IAAA,KAAA,SAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,gBAAA,4BAAE;YAA7B,IAAM,CAAC,WAAA;YACV,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBAClB,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;aACpB;SACF;;;;;;;;;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import { omit } from "./omit";
2
- describe("omit", function () {
3
- test("should return a copy of the object with the specified keys omitted", function () {
4
- var obj = { a: "a", b: "b", c: "c" };
5
- expect(omit(obj, "a", "c")).toEqual({ b: "b" });
6
- // Check that it was a copy and original is not mutated
7
- expect(obj).toEqual({ a: "a", b: "b", c: "c" });
8
- });
9
- });
10
- //# sourceMappingURL=omit.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"omit.spec.js","sourceRoot":"","sources":["../../../src/object/omit.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,QAAQ,CAAC,MAAM,EAAE;IACf,IAAI,CAAC,oEAAoE,EAAE;QACzE,IAAM,GAAG,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAChD,uDAAuD;QACvD,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- /** Set the value at `path` on `object`. */
2
- export declare function setPath(object: any, path: PropertyKey | PropertyKey[], newValue: any): void;
@@ -1,45 +0,0 @@
1
- var __values = (this && this.__values) || function(o) {
2
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
- if (m) return m.call(o);
4
- if (o && typeof o.length === "number") return {
5
- next: function () {
6
- if (o && i >= o.length) o = void 0;
7
- return { value: o && o[i++], done: !o };
8
- }
9
- };
10
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
- };
12
- import * as isEmptyImport from "lodash.isempty";
13
- import { crumblePath } from "./crumble-path";
14
- var isEmpty = isEmptyImport.default || isEmptyImport;
15
- /** Set the value at `path` on `object`. */
16
- export function setPath(object, path, newValue) {
17
- var e_1, _a;
18
- if (typeof object !== "object") {
19
- throw new Error("object is required");
20
- }
21
- if (isEmpty(path)) {
22
- throw new Error("path is required");
23
- }
24
- var crumbs = crumblePath(path);
25
- var finalCrumb = crumbs.splice(crumbs.length - 1, 1)[0];
26
- var current = object;
27
- try {
28
- for (var crumbs_1 = __values(crumbs), crumbs_1_1 = crumbs_1.next(); !crumbs_1_1.done; crumbs_1_1 = crumbs_1.next()) {
29
- var crumb = crumbs_1_1.value;
30
- current = current[crumb];
31
- if (typeof current !== "object") {
32
- throw new Error("Cannot set value at given path: Path deadends at " + String(crumb));
33
- }
34
- }
35
- }
36
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
37
- finally {
38
- try {
39
- if (crumbs_1_1 && !crumbs_1_1.done && (_a = crumbs_1.return)) _a.call(crumbs_1);
40
- }
41
- finally { if (e_1) throw e_1.error; }
42
- }
43
- current[finalCrumb] = newValue;
44
- }
45
- //# sourceMappingURL=set-path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"set-path.js","sourceRoot":"","sources":["../../../src/object/set-path.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,IAAM,OAAO,GAAI,aAAqB,CAAC,OAAO,IAAI,aAAa,CAAC;AAEhE,2CAA2C;AAC3C,MAAM,UAAU,OAAO,CAAC,MAAW,EAAE,IAAiC,EAAE,QAAa;;IACnF,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;KACvC;IAED,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KACrC;IAED,IAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACjC,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1D,IAAI,OAAO,GAAG,MAAM,CAAC;;QACrB,KAAoB,IAAA,WAAA,SAAA,MAAM,CAAA,8BAAA,kDAAE;YAAvB,IAAM,KAAK,mBAAA;YACd,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;gBAC/B,MAAM,IAAI,KAAK,CAAC,sDAAoD,MAAM,CAAC,KAAK,CAAG,CAAC,CAAC;aACtF;SACF;;;;;;;;;IAED,OAAO,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;AACjC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,36 +0,0 @@
1
- import { setPath } from "./set-path";
2
- describe("setPath", function () {
3
- test("sets the value at the given path", function () {
4
- var obj = {
5
- a: { b: { c: false } },
6
- };
7
- setPath(obj, "a.b.c", true);
8
- expect(obj.a.b.c).toBe(true);
9
- });
10
- test("sets the value at the given path when an array is involved", function () {
11
- var obj = {
12
- a: {
13
- b: {
14
- c: [2,
15
- 4,
16
- 5],
17
- },
18
- },
19
- };
20
- setPath(obj, "a.b.c[2]", 6);
21
- expect(obj.a.b.c[2]).toBe(6);
22
- });
23
- test("errors if object isn't provided", function () {
24
- expect(function () { return setPath(undefined, "foo", "bar"); }).toThrow();
25
- });
26
- test("errors if path isn't provided", function () {
27
- expect(function () { return setPath({}, undefined, "bar"); }).toThrow();
28
- });
29
- test("errors if path deadends", function () {
30
- var obj = {
31
- a: {},
32
- };
33
- expect(function () { return setPath(obj, "a.b.c", true); }).toThrow();
34
- });
35
- });
36
- //# sourceMappingURL=set-path.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"set-path.spec.js","sourceRoot":"","sources":["../../../src/object/set-path.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,QAAQ,CAAC,SAAS,EAAE;IAClB,IAAI,CAAC,kCAAkC,EAAE;QACvC,IAAM,GAAG,GAAG;YACV,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;SACvB,CAAC;QACF,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4DAA4D,EAAE;QACjE,IAAM,GAAG,GAAG;YACV,CAAC,EAAE;gBACD,CAAC,EAAE;oBACD,CAAC,EAAE,CAAC,CAAC;wBACH,CAAC;wBACD,CAAC,CAAC;iBACL;aACF;SACF,CAAC;QACF,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAC5B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,iCAAiC,EAAE;QACtC,MAAM,CAAC,cAAM,OAAA,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,EAAhC,CAAgC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,+BAA+B,EAAE;QACpC,MAAM,CAAC,cAAM,OAAA,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,EAA7B,CAA6B,CAAC,CAAC,OAAO,EAAE,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yBAAyB,EAAE;QAC9B,IAAM,GAAG,GAAG;YACV,CAAC,EAAE,EAAE;SACN,CAAC;QAEF,MAAM,CAAC,cAAM,OAAA,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAA3B,CAA2B,CAAC,CAAC,OAAO,EAAE,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- /** Generator for iterating down a path on an object. */
2
- export declare function traversePath(object: any, path: any): Generator<any, void, unknown>;
@@ -1,81 +0,0 @@
1
- var __generator = (this && this.__generator) || function (thisArg, body) {
2
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
3
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
4
- function verb(n) { return function (v) { return step([n, v]); }; }
5
- function step(op) {
6
- if (f) throw new TypeError("Generator is already executing.");
7
- while (_) try {
8
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
9
- if (y = 0, t) op = [op[0] & 2, t.value];
10
- switch (op[0]) {
11
- case 0: case 1: t = op; break;
12
- case 4: _.label++; return { value: op[1], done: false };
13
- case 5: _.label++; y = op[1]; op = [0]; continue;
14
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
15
- default:
16
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
17
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
18
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
19
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
20
- if (t[2]) _.ops.pop();
21
- _.trys.pop(); continue;
22
- }
23
- op = body.call(thisArg, _);
24
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
25
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
26
- }
27
- };
28
- var __values = (this && this.__values) || function(o) {
29
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
30
- if (m) return m.call(o);
31
- if (o && typeof o.length === "number") return {
32
- next: function () {
33
- if (o && i >= o.length) o = void 0;
34
- return { value: o && o[i++], done: !o };
35
- }
36
- };
37
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
38
- };
39
- import { crumblePath } from "./crumble-path";
40
- /** Generator for iterating down a path on an object. */
41
- export function traversePath(object, path) {
42
- var obj, _a, _b, crumb, e_1_1;
43
- var e_1, _c;
44
- return __generator(this, function (_d) {
45
- switch (_d.label) {
46
- case 0: return [4 /*yield*/, object];
47
- case 1:
48
- _d.sent();
49
- obj = object;
50
- _d.label = 2;
51
- case 2:
52
- _d.trys.push([2, 7, 8, 9]);
53
- _a = __values(crumblePath(path)), _b = _a.next();
54
- _d.label = 3;
55
- case 3:
56
- if (!!_b.done) return [3 /*break*/, 6];
57
- crumb = _b.value;
58
- obj = obj[crumb];
59
- return [4 /*yield*/, obj];
60
- case 4:
61
- _d.sent();
62
- _d.label = 5;
63
- case 5:
64
- _b = _a.next();
65
- return [3 /*break*/, 3];
66
- case 6: return [3 /*break*/, 9];
67
- case 7:
68
- e_1_1 = _d.sent();
69
- e_1 = { error: e_1_1 };
70
- return [3 /*break*/, 9];
71
- case 8:
72
- try {
73
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
74
- }
75
- finally { if (e_1) throw e_1.error; }
76
- return [7 /*endfinally*/];
77
- case 9: return [2 /*return*/];
78
- }
79
- });
80
- }
81
- //# sourceMappingURL=traverse-path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"traverse-path.js","sourceRoot":"","sources":["../../../src/object/traverse-path.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,wDAAwD;AACxD,MAAM,UAAW,YAAY,CAAC,MAAM,EAAE,IAAI;;;;;oBACxC,qBAAM,MAAM,EAAA;;gBAAZ,SAAY,CAAC;gBACT,GAAG,GAAG,MAAM,CAAC;;;;gBACG,KAAA,SAAA,WAAW,CAAC,IAAI,CAAC,CAAA;;;;gBAA1B,KAAK;gBACd,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;gBACjB,qBAAM,GAAG,EAAA;;gBAAT,SAAS,CAAC;;;;;;;;;;;;;;;;;;;CAEb"}
@@ -1,2 +0,0 @@
1
- /** Returns the values of an object. */
2
- export declare function values(object: any): any[];
@@ -1,31 +0,0 @@
1
- var __values = (this && this.__values) || function(o) {
2
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
- if (m) return m.call(o);
4
- if (o && typeof o.length === "number") return {
5
- next: function () {
6
- if (o && i >= o.length) o = void 0;
7
- return { value: o && o[i++], done: !o };
8
- }
9
- };
10
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
- };
12
- /** Returns the values of an object. */
13
- export function values(object) {
14
- var e_1, _a;
15
- var vals = [];
16
- try {
17
- for (var _b = __values(Object.keys(object)), _c = _b.next(); !_c.done; _c = _b.next()) {
18
- var key = _c.value;
19
- vals.push(object[key]);
20
- }
21
- }
22
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
23
- finally {
24
- try {
25
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
26
- }
27
- finally { if (e_1) throw e_1.error; }
28
- }
29
- return vals;
30
- }
31
- //# sourceMappingURL=values.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"values.js","sourceRoot":"","sources":["../../../src/object/values.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAAuC;AACvC,MAAM,UAAU,MAAM,CAAC,MAAW;;IAChC,IAAM,IAAI,GAAG,EAAE,CAAC;;QAChB,KAAkB,IAAA,KAAA,SAAA,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,gBAAA,4BAAE;YAAlC,IAAM,GAAG,WAAA;YACZ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;SACxB;;;;;;;;;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import { values } from "./values";
2
- describe("values", function () {
3
- test("retrieves the values of an object", function () {
4
- expect(values({ a: 10, b: "foo" })).toEqual([10, "foo"]);
5
- });
6
- });
7
- //# sourceMappingURL=values.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"values.spec.js","sourceRoot":"","sources":["../../../src/object/values.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,QAAQ,CAAC,QAAQ,EAAE;IACjB,IAAI,CAAC,mCAAmC,EAAE;QACxC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- /** Template tag function for making strings containing code blocks easier to deal with. */
2
- export declare function code(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
@@ -1,38 +0,0 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
- if (ar || !(i in from)) {
20
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
- ar[i] = from[i];
22
- }
23
- }
24
- return to.concat(ar || Array.prototype.slice.call(from));
25
- };
26
- /** Template tag function for making strings containing code blocks easier to deal with. */
27
- export function code(strings) {
28
- var interpolations = [];
29
- for (var _i = 1; _i < arguments.length; _i++) {
30
- interpolations[_i - 1] = arguments[_i];
31
- }
32
- var s = strings.reduce(function (a, b, i) { return "" + a + (i <= interpolations.length ? String(interpolations[i - 1]) : "") + b; });
33
- var leadingWhitespace = Math.min.apply(Math, __spreadArray([], __read(s.split(/[\r\n]/)
34
- .filter(function (l) { return l.trim(); })
35
- .map(function (l) { return (/^ */.exec(l))[0].length; })), false));
36
- return s.replace(new RegExp("^ {" + leadingWhitespace + "}", "gm"), "").trim();
37
- }
38
- //# sourceMappingURL=code.template-tag.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code.template-tag.js","sourceRoot":"","sources":["../../../src/string/code.template-tag.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2FAA2F;AAC3F,MAAM,UAAU,IAAI,CAAC,OAA6B;IAAE,wBAA4B;SAA5B,UAA4B,EAA5B,qBAA4B,EAA5B,IAA4B;QAA5B,uCAA4B;;IAC9E,IAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,UAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAK,OAAA,KAAG,CAAC,IAAG,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAG,CAAG,EAA5E,CAA4E,CAAC,CAAC;IACpH,IAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,2BACzB,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;SACjB,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,EAAE,EAAR,CAAQ,CAAC;SACvB,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAzB,CAAyB,CAAC,UACzC,CAAC;IACF,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,QAAM,iBAAiB,MAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5E,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from "./code.template-tag";
2
- export * from "./parse-file-size";
3
- export * from "./template";
@@ -1,4 +0,0 @@
1
- export * from "./code.template-tag";
2
- export * from "./parse-file-size";
3
- export * from "./template";
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/string/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Parses a string as a file size and returns the size in bytes. For example,
3
- * `parseFileSize("2KB")` will return `2048`.
4
- */
5
- export declare function parseFileSize(fileSize: string): number;
@@ -1,43 +0,0 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
- /**
18
- * Parses a string as a file size and returns the size in bytes. For example,
19
- * `parseFileSize("2KB")` will return `2048`.
20
- */
21
- export function parseFileSize(fileSize) {
22
- var unitMatch = /[A-Z]?B$/.exec(fileSize);
23
- if (!unitMatch) {
24
- throw new Error("Input to parseFileSize (\"" + fileSize + "\") doesn't seem like a file size; "
25
- + "cannot identify a unit (e.g. KB, GB)");
26
- }
27
- var _a = __read(unitMatch, 1), unit = _a[0];
28
- var num = Number(fileSize.replace(unit, ""));
29
- if (Number.isNaN(num)) {
30
- throw new Error("Could not parse a number out of input to parseFileSize (\"" + fileSize + "\")");
31
- }
32
- var magnitude = ["B",
33
- "KB",
34
- "MB",
35
- "GB",
36
- "TB",
37
- "PB"].indexOf(unit);
38
- if (magnitude === -1) {
39
- throw new Error("parseFileSize does not support units above PB");
40
- }
41
- return Math.ceil(num * (Math.pow(1024, magnitude)));
42
- }
43
- //# sourceMappingURL=parse-file-size.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-file-size.js","sourceRoot":"","sources":["../../../src/string/parse-file-size.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CACb,+BAA4B,QAAQ,wCAAoC;cAChE,sCAAsC,CAC/C,CAAC;KACH;IAEK,IAAA,KAAA,OAAS,SAAS,IAAA,EAAjB,IAAI,QAAa,CAAC;IACzB,IAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/C,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,+DAA4D,QAAQ,QAAI,CAAC,CAAC;KAC3F;IAED,IAAM,SAAS,GAAG,CAAC,GAAG;QACpB,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;KAClE;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAA,IAAI,EAAI,SAAS,CAAA,CAAC,CAAC,CAAC;AAC9C,CAAC"}
@@ -1,15 +0,0 @@
1
- declare type TemplateFn = (data: any) => string;
2
- /**
3
- * Every string templating thing out there whether lodash, doT, handlebars, etc
4
- * is extremely complicated to cover a variety of use cases. This just has two
5
- * very simple features and great caution should be exercised in making it any more
6
- * complex than that. A value can be interpolated like so:
7
- * `<%= foo.bar %>`
8
- * And a basic "if" conditional can be used like so:
9
- * `<%? a?.b?.c %>This part will only appear if a.b.c is truthy!</%>`
10
- * You can put interpolations inside a conditional, as you'd expect. That's it.
11
- */
12
- export declare function template(string: string): TemplateFn;
13
- export declare function isTemplate(x: any): x is string;
14
- export declare function isTemplateFn(x: any): x is TemplateFn;
15
- export {};
@@ -1,28 +0,0 @@
1
- import { getPath } from "../object";
2
- var REGEX_REPLACEMENT = /(<%=|{{)(.+?)(%>|}})/g;
3
- var REGEX_IF = /<%\?(.+?)%>(.+?)<\/%>/g;
4
- var SYMBOL_TEMPLATE_SOURCE = Symbol("sps.utils.templateSrc");
5
- /**
6
- * Every string templating thing out there whether lodash, doT, handlebars, etc
7
- * is extremely complicated to cover a variety of use cases. This just has two
8
- * very simple features and great caution should be exercised in making it any more
9
- * complex than that. A value can be interpolated like so:
10
- * `<%= foo.bar %>`
11
- * And a basic "if" conditional can be used like so:
12
- * `<%? a?.b?.c %>This part will only appear if a.b.c is truthy!</%>`
13
- * You can put interpolations inside a conditional, as you'd expect. That's it.
14
- */
15
- export function template(string) {
16
- var fn = function (data) { return string
17
- .replace(REGEX_IF, function (match, pathToCheck, content) { return (getPath(data, pathToCheck.trim()) ? content : ""); })
18
- .replace(REGEX_REPLACEMENT, function (match, _, pathToInterpolate) { return getPath(data, pathToInterpolate.trim(), ""); }); };
19
- fn[SYMBOL_TEMPLATE_SOURCE] = string;
20
- return fn;
21
- }
22
- export function isTemplate(x) {
23
- return typeof x === "string" && (REGEX_REPLACEMENT.test(x) || REGEX_IF.test(x));
24
- }
25
- export function isTemplateFn(x) {
26
- return typeof x === "function" && Object.prototype.hasOwnProperty.call(x, SYMBOL_TEMPLATE_SOURCE);
27
- }
28
- //# sourceMappingURL=template.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/string/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,IAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAClD,IAAM,QAAQ,GAAG,wBAAwB,CAAC;AAE1C,IAAM,sBAAsB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAI/D;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,IAAM,EAAE,GAAG,UAAC,IAAS,IAAK,OAAA,MAAM;SAC7B,OAAO,CAAC,QAAQ,EAAE,UAAC,KAAK,EAAE,WAAW,EAAE,OAAO,IAAK,OAAA,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAlD,CAAkD,CAAC;SACtG,OAAO,CAAC,iBAAiB,EAAE,UAAC,KAAK,EAAE,CAAC,EAAE,iBAAiB,IAAK,OAAA,OAAO,CAAC,IAAI,EAAE,iBAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAA3C,CAA2C,CAAC,EAFjF,CAEiF,CAAC;IAC5G,EAAE,CAAC,sBAAsB,CAAC,GAAG,MAAM,CAAC;IACpC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAM;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAM;IACjC,OAAO,OAAO,CAAC,KAAK,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC;AACpG,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,39 +0,0 @@
1
- import { template } from "./template";
2
- describe("template", function () {
3
- test("correctly interpolates from data", function () {
4
- var templateString = "test ---> <%= a.b %> <--- test";
5
- var data = { a: { b: "foo" } };
6
- var expected = "test ---> foo <--- test";
7
- expect(template(templateString)(data)).toBe(expected);
8
- });
9
- test("correctly interpolates from data, alternate", function () {
10
- var templateString = "test ---> {{a.b}} <--- test";
11
- var data = { a: { b: "foo" } };
12
- var expected = "test ---> foo <--- test";
13
- expect(template(templateString)(data)).toBe(expected);
14
- });
15
- test("supports optional chaining", function () {
16
- var templateString = "test ---> <%= a?.b %> <--- test";
17
- var data = {};
18
- var expected = "test ---> <--- test";
19
- expect(template(templateString)(data)).toBe(expected);
20
- });
21
- test("throws if non-optional chaining breaks", function () {
22
- var templateString = "test ---> <%= a.b %> <--- test";
23
- var data = {};
24
- expect(function () { return template(templateString)(data); }).toThrow();
25
- });
26
- test("removes falsy conditionals", function () {
27
- var templateString = "test ---><%? a.c %> <%= a.b %> <--- test</%>";
28
- var data = { a: { b: "foo" } };
29
- var expected = "test --->";
30
- expect(template(templateString)(data)).toBe(expected);
31
- });
32
- test("retains truthy conditionals & process any interpolations within", function () {
33
- var templateString = "test ---><%? a.c %> <%= a.b %> <--- test</%>";
34
- var data = { a: { b: "foo", c: true } };
35
- var expected = "test ---> foo <--- test";
36
- expect(template(templateString)(data)).toBe(expected);
37
- });
38
- });
39
- //# sourceMappingURL=template.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template.spec.js","sourceRoot":"","sources":["../../../src/string/template.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,QAAQ,CAAC,UAAU,EAAE;IACnB,IAAI,CAAC,kCAAkC,EAAE;QACvC,IAAM,cAAc,GAAG,gCAAgC,CAAC;QACxD,IAAM,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QACjC,IAAM,QAAQ,GAAG,yBAAyB,CAAC;QAC3C,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,6CAA6C,EAAE;QAClD,IAAM,cAAc,GAAG,6BAA6B,CAAC;QACrD,IAAM,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QACjC,IAAM,QAAQ,GAAG,yBAAyB,CAAC;QAC3C,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4BAA4B,EAAE;QACjC,IAAM,cAAc,GAAG,iCAAiC,CAAC;QACzD,IAAM,IAAI,GAAG,EAAE,CAAC;QAChB,IAAM,QAAQ,GAAG,sBAAsB,CAAC;QACxC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wCAAwC,EAAE;QAC7C,IAAM,cAAc,GAAG,gCAAgC,CAAC;QACxD,IAAM,IAAI,GAAG,EAAE,CAAC;QAChB,MAAM,CAAC,cAAM,OAAA,QAAQ,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAA9B,CAA8B,CAAC,CAAC,OAAO,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4BAA4B,EAAE;QACjC,IAAM,cAAc,GAAG,8CAA8C,CAAC;QACtE,IAAM,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QACjC,IAAM,QAAQ,GAAG,WAAW,CAAC;QAC7B,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,iEAAiE,EAAE;QACtE,IAAM,cAAc,GAAG,8CAA8C,CAAC;QACtE,IAAM,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;QAC1C,IAAM,QAAQ,GAAG,yBAAyB,CAAC;QAC3C,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare type Eventually<T> = T | Promise<T>;
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=typings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typings.js","sourceRoot":"","sources":["../../src/typings.ts"],"names":[],"mappings":""}
package/rollup.config.js DELETED
@@ -1,22 +0,0 @@
1
- import commonjs from "@rollup/plugin-commonjs";
2
- import resolve from "@rollup/plugin-node-resolve";
3
- import pkg from "./package.json";
4
-
5
- export default {
6
- input: "dist/out-tsc/index.js",
7
- output: [
8
- {
9
- file: pkg.main,
10
- format: "cjs",
11
- },
12
- {
13
- file: pkg.module,
14
- format: "es",
15
- },
16
- ],
17
- external: Object.keys(pkg.peerDependencies || {}),
18
- plugins: [
19
- resolve(),
20
- commonjs(),
21
- ],
22
- };