@spscommerce/utils 5.5.0-ie → 5.7.0

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 (210) hide show
  1. package/{dist/out-tsc → lib}/array/flatten.d.ts +0 -0
  2. package/{dist/out-tsc → lib}/array/flatten.spec.d.ts +0 -0
  3. package/{dist/out-tsc → lib}/array/index.d.ts +0 -0
  4. package/{dist/out-tsc → lib}/array/is-subset.d.ts +0 -0
  5. package/{dist/out-tsc → lib}/array/is-subset.spec.d.ts +0 -0
  6. package/{dist/out-tsc → lib}/array/range.d.ts +0 -0
  7. package/{dist/out-tsc → lib}/array/range.spec.d.ts +0 -0
  8. package/{dist/out-tsc → lib}/classes/custom-event.d.ts +0 -0
  9. package/{dist/out-tsc → lib}/classes/index.d.ts +0 -0
  10. package/{dist/out-tsc → lib}/data/doctypes.d.ts +0 -0
  11. package/{dist/out-tsc → lib}/data/index.d.ts +0 -0
  12. package/{dist/out-tsc → lib}/decorators/cast-to-number.d.ts +0 -0
  13. package/{dist/out-tsc → lib}/decorators/debounced.broken_spec.d.ts +0 -0
  14. package/{dist/out-tsc → lib}/decorators/debounced.d.ts +0 -0
  15. package/{dist/out-tsc → lib}/decorators/index.d.ts +0 -0
  16. package/{dist/out-tsc → lib}/decorators/locked-to-animation-frames.d.ts +0 -0
  17. package/{dist/out-tsc → lib}/decorators/locked-to-animation-frames.spec.d.ts +0 -0
  18. package/{dist/out-tsc → lib}/decorators/simple-metadata-decorator-applicator.d.ts +0 -0
  19. package/{dist/out-tsc → lib}/decorators/tick-delay.d.ts +0 -0
  20. package/{dist/out-tsc → lib}/function/debounce.d.ts +0 -0
  21. package/{dist/out-tsc → lib}/function/debounce.spec.d.ts +0 -0
  22. package/{dist/out-tsc → lib}/function/debounced-function.interface.d.ts +0 -0
  23. package/{dist/out-tsc → lib}/function/delayed-function.interface.d.ts +0 -0
  24. package/{dist/out-tsc → lib}/function/index.d.ts +0 -0
  25. package/{dist/out-tsc → lib}/function/lock-to-animation-frames.d.ts +0 -0
  26. package/{dist/out-tsc → lib}/function/lock-to-animation-frames.spec.d.ts +0 -0
  27. package/{dist/out-tsc → lib}/function/on-next-tick.d.ts +0 -0
  28. package/{dist/out-tsc → lib}/function/on-next-tick.spec.d.ts +0 -0
  29. package/{dist/out-tsc → lib}/function/op.d.ts +0 -0
  30. package/{dist/out-tsc → lib}/function/op.spec.d.ts +0 -0
  31. package/lib/index.cjs.js +1 -0
  32. package/{dist/out-tsc → lib}/index.d.ts +0 -0
  33. package/lib/index.es.js +1024 -0
  34. package/{dist/out-tsc → lib}/number/constrain.d.ts +0 -0
  35. package/{dist/out-tsc → lib}/number/decimal-round.d.ts +0 -0
  36. package/{dist/out-tsc → lib}/number/decimal-round.spec.d.ts +0 -0
  37. package/{dist/out-tsc → lib}/number/index.d.ts +0 -0
  38. package/{dist/out-tsc → lib}/number/to-file-size-string.d.ts +0 -0
  39. package/{dist/out-tsc → lib}/object/copy-property.d.ts +0 -0
  40. package/{dist/out-tsc → lib}/object/copy-property.spec.d.ts +0 -0
  41. package/{dist/out-tsc → lib}/object/crumble-path.d.ts +0 -0
  42. package/{dist/out-tsc → lib}/object/crumble-path.spec.d.ts +0 -0
  43. package/{dist/out-tsc → lib}/object/deep-freeze.d.ts +0 -0
  44. package/{dist/out-tsc → lib}/object/deep-freeze.spec.d.ts +0 -0
  45. package/{dist/out-tsc → lib}/object/diff.d.ts +0 -0
  46. package/{dist/out-tsc → lib}/object/diff.spec.d.ts +0 -0
  47. package/{dist/out-tsc → lib}/object/for-each-entry-deep.d.ts +0 -0
  48. package/{dist/out-tsc → lib}/object/for-each-entry-deep.spec.d.ts +0 -0
  49. package/{dist/out-tsc → lib}/object/for-each-nested-object.d.ts +0 -0
  50. package/{dist/out-tsc → lib}/object/for-each-nested-object.spec.d.ts +0 -0
  51. package/{dist/out-tsc → lib}/object/get-path.d.ts +0 -0
  52. package/{dist/out-tsc → lib}/object/get-path.spec.d.ts +0 -0
  53. package/{dist/out-tsc → lib}/object/index.d.ts +0 -0
  54. package/{dist/out-tsc → lib}/object/merge-deep.d.ts +0 -0
  55. package/{dist/out-tsc → lib}/object/merge-deep.spec.d.ts +0 -0
  56. package/{dist/out-tsc → lib}/object/merge-properties-deep.d.ts +0 -0
  57. package/{dist/out-tsc → lib}/object/merge-properties-deep.spec.d.ts +0 -0
  58. package/{dist/out-tsc → lib}/object/omit.d.ts +0 -0
  59. package/{dist/out-tsc → lib}/object/omit.spec.d.ts +0 -0
  60. package/{dist/out-tsc → lib}/object/set-path.d.ts +0 -0
  61. package/{dist/out-tsc → lib}/object/set-path.spec.d.ts +0 -0
  62. package/{dist/out-tsc → lib}/object/traverse-path.d.ts +0 -0
  63. package/{dist/out-tsc → lib}/object/values.d.ts +0 -0
  64. package/{dist/out-tsc → lib}/object/values.spec.d.ts +0 -0
  65. package/{dist/out-tsc → lib}/string/code.template-tag.d.ts +0 -0
  66. package/{dist/out-tsc → lib}/string/index.d.ts +0 -0
  67. package/{dist/out-tsc → lib}/string/parse-file-size.d.ts +0 -0
  68. package/{dist/out-tsc → lib}/string/template.d.ts +0 -0
  69. package/{dist/out-tsc → lib}/string/template.spec.d.ts +0 -0
  70. package/{dist/out-tsc → lib}/typings.d.ts +0 -0
  71. package/package.json +5 -5
  72. package/vite.config.js +1 -1
  73. package/.pnpm-debug.log +0 -20
  74. package/dist/out-tsc/array/flatten.js +0 -7
  75. package/dist/out-tsc/array/flatten.js.map +0 -1
  76. package/dist/out-tsc/array/flatten.spec.js +0 -10
  77. package/dist/out-tsc/array/flatten.spec.js.map +0 -1
  78. package/dist/out-tsc/array/index.js +0 -4
  79. package/dist/out-tsc/array/index.js.map +0 -1
  80. package/dist/out-tsc/array/is-subset.js +0 -41
  81. package/dist/out-tsc/array/is-subset.js.map +0 -1
  82. package/dist/out-tsc/array/is-subset.spec.js +0 -41
  83. package/dist/out-tsc/array/is-subset.spec.js.map +0 -1
  84. package/dist/out-tsc/array/range.js +0 -16
  85. package/dist/out-tsc/array/range.js.map +0 -1
  86. package/dist/out-tsc/array/range.spec.js +0 -26
  87. package/dist/out-tsc/array/range.spec.js.map +0 -1
  88. package/dist/out-tsc/classes/custom-event.js +0 -87
  89. package/dist/out-tsc/classes/custom-event.js.map +0 -1
  90. package/dist/out-tsc/classes/index.js +0 -2
  91. package/dist/out-tsc/classes/index.js.map +0 -1
  92. package/dist/out-tsc/data/doctypes.js +0 -302
  93. package/dist/out-tsc/data/doctypes.js.map +0 -1
  94. package/dist/out-tsc/data/index.js +0 -2
  95. package/dist/out-tsc/data/index.js.map +0 -1
  96. package/dist/out-tsc/decorators/cast-to-number.js +0 -29
  97. package/dist/out-tsc/decorators/cast-to-number.js.map +0 -1
  98. package/dist/out-tsc/decorators/debounced.broken_spec.js +0 -38
  99. package/dist/out-tsc/decorators/debounced.broken_spec.js.map +0 -1
  100. package/dist/out-tsc/decorators/debounced.js +0 -35
  101. package/dist/out-tsc/decorators/debounced.js.map +0 -1
  102. package/dist/out-tsc/decorators/index.js +0 -6
  103. package/dist/out-tsc/decorators/index.js.map +0 -1
  104. package/dist/out-tsc/decorators/locked-to-animation-frames.js +0 -34
  105. package/dist/out-tsc/decorators/locked-to-animation-frames.js.map +0 -1
  106. package/dist/out-tsc/decorators/locked-to-animation-frames.spec.js +0 -63
  107. package/dist/out-tsc/decorators/locked-to-animation-frames.spec.js.map +0 -1
  108. package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.js +0 -80
  109. package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.js.map +0 -1
  110. package/dist/out-tsc/decorators/tick-delay.js +0 -31
  111. package/dist/out-tsc/decorators/tick-delay.js.map +0 -1
  112. package/dist/out-tsc/function/debounce.js +0 -102
  113. package/dist/out-tsc/function/debounce.js.map +0 -1
  114. package/dist/out-tsc/function/debounce.spec.js +0 -150
  115. package/dist/out-tsc/function/debounce.spec.js.map +0 -1
  116. package/dist/out-tsc/function/debounced-function.interface.js +0 -2
  117. package/dist/out-tsc/function/debounced-function.interface.js.map +0 -1
  118. package/dist/out-tsc/function/delayed-function.interface.js +0 -2
  119. package/dist/out-tsc/function/delayed-function.interface.js.map +0 -1
  120. package/dist/out-tsc/function/index.js +0 -7
  121. package/dist/out-tsc/function/index.js.map +0 -1
  122. package/dist/out-tsc/function/lock-to-animation-frames.js +0 -43
  123. package/dist/out-tsc/function/lock-to-animation-frames.js.map +0 -1
  124. package/dist/out-tsc/function/lock-to-animation-frames.spec.js +0 -53
  125. package/dist/out-tsc/function/lock-to-animation-frames.spec.js.map +0 -1
  126. package/dist/out-tsc/function/on-next-tick.js +0 -12
  127. package/dist/out-tsc/function/on-next-tick.js.map +0 -1
  128. package/dist/out-tsc/function/on-next-tick.spec.js +0 -13
  129. package/dist/out-tsc/function/on-next-tick.spec.js.map +0 -1
  130. package/dist/out-tsc/function/op.js +0 -34
  131. package/dist/out-tsc/function/op.js.map +0 -1
  132. package/dist/out-tsc/function/op.spec.js +0 -94
  133. package/dist/out-tsc/function/op.spec.js.map +0 -1
  134. package/dist/out-tsc/index.js +0 -10
  135. package/dist/out-tsc/index.js.map +0 -1
  136. package/dist/out-tsc/number/constrain.js +0 -16
  137. package/dist/out-tsc/number/constrain.js.map +0 -1
  138. package/dist/out-tsc/number/decimal-round.js +0 -19
  139. package/dist/out-tsc/number/decimal-round.js.map +0 -1
  140. package/dist/out-tsc/number/decimal-round.spec.js +0 -10
  141. package/dist/out-tsc/number/decimal-round.spec.js.map +0 -1
  142. package/dist/out-tsc/number/index.js +0 -4
  143. package/dist/out-tsc/number/index.js.map +0 -1
  144. package/dist/out-tsc/number/to-file-size-string.js +0 -24
  145. package/dist/out-tsc/number/to-file-size-string.js.map +0 -1
  146. package/dist/out-tsc/object/copy-property.js +0 -9
  147. package/dist/out-tsc/object/copy-property.js.map +0 -1
  148. package/dist/out-tsc/object/copy-property.spec.js +0 -16
  149. package/dist/out-tsc/object/copy-property.spec.js.map +0 -1
  150. package/dist/out-tsc/object/crumble-path.js +0 -9
  151. package/dist/out-tsc/object/crumble-path.js.map +0 -1
  152. package/dist/out-tsc/object/crumble-path.spec.js +0 -24
  153. package/dist/out-tsc/object/crumble-path.spec.js.map +0 -1
  154. package/dist/out-tsc/object/deep-freeze.js +0 -36
  155. package/dist/out-tsc/object/deep-freeze.js.map +0 -1
  156. package/dist/out-tsc/object/deep-freeze.spec.js +0 -14
  157. package/dist/out-tsc/object/deep-freeze.spec.js.map +0 -1
  158. package/dist/out-tsc/object/diff.js +0 -92
  159. package/dist/out-tsc/object/diff.js.map +0 -1
  160. package/dist/out-tsc/object/diff.spec.js +0 -40
  161. package/dist/out-tsc/object/diff.spec.js.map +0 -1
  162. package/dist/out-tsc/object/for-each-entry-deep.js +0 -38
  163. package/dist/out-tsc/object/for-each-entry-deep.js.map +0 -1
  164. package/dist/out-tsc/object/for-each-entry-deep.spec.js +0 -24
  165. package/dist/out-tsc/object/for-each-entry-deep.spec.js.map +0 -1
  166. package/dist/out-tsc/object/for-each-nested-object.js +0 -38
  167. package/dist/out-tsc/object/for-each-nested-object.js.map +0 -1
  168. package/dist/out-tsc/object/for-each-nested-object.spec.js +0 -46
  169. package/dist/out-tsc/object/for-each-nested-object.spec.js.map +0 -1
  170. package/dist/out-tsc/object/get-path.js +0 -67
  171. package/dist/out-tsc/object/get-path.js.map +0 -1
  172. package/dist/out-tsc/object/get-path.spec.js +0 -44
  173. package/dist/out-tsc/object/get-path.spec.js.map +0 -1
  174. package/dist/out-tsc/object/index.js +0 -14
  175. package/dist/out-tsc/object/index.js.map +0 -1
  176. package/dist/out-tsc/object/merge-deep.js +0 -60
  177. package/dist/out-tsc/object/merge-deep.js.map +0 -1
  178. package/dist/out-tsc/object/merge-deep.spec.js +0 -16
  179. package/dist/out-tsc/object/merge-deep.spec.js.map +0 -1
  180. package/dist/out-tsc/object/merge-properties-deep.js +0 -61
  181. package/dist/out-tsc/object/merge-properties-deep.js.map +0 -1
  182. package/dist/out-tsc/object/merge-properties-deep.spec.js +0 -24
  183. package/dist/out-tsc/object/merge-properties-deep.spec.js.map +0 -1
  184. package/dist/out-tsc/object/omit.js +0 -40
  185. package/dist/out-tsc/object/omit.js.map +0 -1
  186. package/dist/out-tsc/object/omit.spec.js +0 -10
  187. package/dist/out-tsc/object/omit.spec.js.map +0 -1
  188. package/dist/out-tsc/object/set-path.js +0 -45
  189. package/dist/out-tsc/object/set-path.js.map +0 -1
  190. package/dist/out-tsc/object/set-path.spec.js +0 -36
  191. package/dist/out-tsc/object/set-path.spec.js.map +0 -1
  192. package/dist/out-tsc/object/traverse-path.js +0 -81
  193. package/dist/out-tsc/object/traverse-path.js.map +0 -1
  194. package/dist/out-tsc/object/values.js +0 -31
  195. package/dist/out-tsc/object/values.js.map +0 -1
  196. package/dist/out-tsc/object/values.spec.js +0 -7
  197. package/dist/out-tsc/object/values.spec.js.map +0 -1
  198. package/dist/out-tsc/string/code.template-tag.js +0 -38
  199. package/dist/out-tsc/string/code.template-tag.js.map +0 -1
  200. package/dist/out-tsc/string/index.js +0 -4
  201. package/dist/out-tsc/string/index.js.map +0 -1
  202. package/dist/out-tsc/string/parse-file-size.js +0 -43
  203. package/dist/out-tsc/string/parse-file-size.js.map +0 -1
  204. package/dist/out-tsc/string/template.js +0 -28
  205. package/dist/out-tsc/string/template.js.map +0 -1
  206. package/dist/out-tsc/string/template.spec.js +0 -39
  207. package/dist/out-tsc/string/template.spec.js.map +0 -1
  208. package/dist/out-tsc/typings.js +0 -2
  209. package/dist/out-tsc/typings.js.map +0 -1
  210. package/rollup.config.js +0 -22
@@ -1,46 +0,0 @@
1
- import { forEachNestedObject } from "./for-each-nested-object";
2
- describe("forEachNestedObject", function () {
3
- test("calls the given function for each nested object within the given root object", function () {
4
- var targetObject = {
5
- path: "",
6
- b: { c: {} },
7
- d: [
8
- {
9
- path: "",
10
- e: { f: {} },
11
- },
12
- { g: "" },
13
- ],
14
- };
15
- function addPath(path, object) {
16
- var joinedPath = path.join(".");
17
- if (Array.isArray(object)) {
18
- object.push(joinedPath);
19
- }
20
- else {
21
- // eslint-disable-next-line no-param-reassign
22
- object.path = joinedPath;
23
- }
24
- }
25
- var expectedResult = {
26
- path: "",
27
- b: { path: "b", c: { path: "b.c" } },
28
- d: [
29
- {
30
- path: "d.0",
31
- e: { path: "d.0.e", f: { path: "d.0.e.f" } },
32
- },
33
- { g: "", path: "d.1" },
34
- "d",
35
- ],
36
- };
37
- forEachNestedObject(targetObject, addPath);
38
- /*
39
- * The fact that addPath() adds properties to the object
40
- * makes TypeScript have a conniption, hence "as any";
41
- * in real code one would use interfaces to address this
42
- */
43
- expect(targetObject).toEqual(expectedResult);
44
- });
45
- });
46
- //# sourceMappingURL=for-each-nested-object.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"for-each-nested-object.spec.js","sourceRoot":"","sources":["../../../src/object/for-each-nested-object.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,QAAQ,CAAC,qBAAqB,EAAE;IAC9B,IAAI,CAAC,8EAA8E,EAAE;QACnF,IAAM,YAAY,GAAG;YACnB,IAAI,EAAE,EAAE;YACR,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;YACZ,CAAC,EAAE;gBACD;oBACE,IAAI,EAAE,EAAE;oBACR,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;iBACb;gBACD,EAAE,CAAC,EAAE,EAAE,EAAE;aACV;SACF,CAAC;QACF,SAAS,OAAO,CAAC,IAAI,EAAE,MAAM;YAC3B,IAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACzB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aACzB;iBAAM;gBACL,6CAA6C;gBAC7C,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;aAC1B;QACH,CAAC;QACD,IAAM,cAAc,GAAG;YACrB,IAAI,EAAE,EAAE;YACR,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;YACpC,CAAC,EAAE;gBACD;oBACE,IAAI,EAAE,KAAK;oBACX,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;iBAC7C;gBACD,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;gBACtB,GAAG;aACJ;SACF,CAAC;QAEF,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAE3C;;;;WAIG;QACH,MAAM,CAAC,YAAmB,CAAC,CAAC,OAAO,CAAC,cAAqB,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,67 +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
- var __read = (this && this.__read) || function (o, n) {
13
- var m = typeof Symbol === "function" && o[Symbol.iterator];
14
- if (!m) return o;
15
- var i = m.call(o), r, ar = [], e;
16
- try {
17
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
- }
19
- catch (error) { e = { error: error }; }
20
- finally {
21
- try {
22
- if (r && !r.done && (m = i["return"])) m.call(i);
23
- }
24
- finally { if (e) throw e.error; }
25
- }
26
- return ar;
27
- };
28
- import * as isNilImport from "lodash.isnil";
29
- import * as isEmptyImport from "lodash.isempty";
30
- import { crumblePath } from "./crumble-path";
31
- var isNil = isNilImport.default || isNilImport;
32
- var isEmpty = isEmptyImport.default || isEmptyImport;
33
- /**
34
- * Get the value at `path` starting from `object`.
35
- * Allows optional chaining, e.g. `get(obj, 'a.b?.c')`
36
- */
37
- export function getPath(object, path, defaultValue, allOptional) {
38
- var e_1, _a, _b;
39
- if (allOptional === void 0) { allOptional = false; }
40
- if (isEmpty(path)) {
41
- return object;
42
- }
43
- var value = object;
44
- try {
45
- for (var _c = __values(crumblePath(path)), _d = _c.next(); !_d.done; _d = _c.next()) {
46
- var crumb = _d.value;
47
- var key = crumb;
48
- var optional = void 0;
49
- if (typeof crumb === "string") {
50
- _b = __read(/^([^?]+)(\?)?$/.exec(crumb), 3), key = _b[1], optional = _b[2];
51
- }
52
- value = value[key];
53
- if (isNil(value) && (optional || allOptional)) {
54
- return defaultValue;
55
- }
56
- }
57
- }
58
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
59
- finally {
60
- try {
61
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
62
- }
63
- finally { if (e_1) throw e_1.error; }
64
- }
65
- return isNil(value) ? defaultValue : value;
66
- }
67
- //# sourceMappingURL=get-path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-path.js","sourceRoot":"","sources":["../../../src/object/get-path.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,IAAM,KAAK,GAAI,WAAmB,CAAC,OAAO,IAAI,WAAW,CAAC;AAC1D,IAAM,OAAO,GAAI,aAAqB,CAAC,OAAO,IAAI,aAAa,CAAC;AAEhE;;;GAGG;AACH,MAAM,UAAU,OAAO,CACrB,MAAW,EACX,IAA0C,EAC1C,YAAgB,EAChB,WAAmB;;IAAnB,4BAAA,EAAA,mBAAmB;IAEnB,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;QACjB,OAAO,MAAM,CAAC;KACf;IAED,IAAI,KAAK,GAAG,MAAM,CAAC;;QACnB,KAAoB,IAAA,KAAA,SAAA,WAAW,CAAC,IAAI,CAAC,CAAA,gBAAA,4BAAE;YAAlC,IAAM,KAAK,WAAA;YACd,IAAI,GAAG,GAAG,KAAK,CAAC;YAChB,IAAI,QAAQ,SAAA,CAAC;YACb,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC7B,KAAA,OACc,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAA,EADvC,GAAG,QAAA,EACJ,QAAQ,QAAA,CAAiC;aAC5C;YAED,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YAEnB,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,IAAI,WAAW,CAAC,EAAE;gBAC7C,OAAO,YAAY,CAAC;aACrB;SACF;;;;;;;;;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7C,CAAC"}
@@ -1,44 +0,0 @@
1
- import { getPath } from "./get-path";
2
- describe("getPath", function () {
3
- test("gets the value at a given dot path", function () {
4
- var object = {
5
- a: {
6
- b: "c",
7
- },
8
- };
9
- expect(getPath(object, "a.b")).toBe("c");
10
- });
11
- test("gets the value at a given array path", function () {
12
- var object = [null,
13
- [null,
14
- null,
15
- "foo"]];
16
- expect(getPath(object, "[1][2]")).toBe("foo");
17
- });
18
- test("supports optional chaining", function () {
19
- var object = {
20
- a: {},
21
- };
22
- expect(getPath(object, "a.b?.c")).toBeUndefined();
23
- });
24
- test("errors when accessing property of missing key when not optional", function () {
25
- var object = {
26
- a: {},
27
- };
28
- expect(function () { return getPath(object, "a.b.c"); }).toThrow();
29
- });
30
- test("returns the given default value if path deadends", function () {
31
- var object = {
32
- a: {},
33
- };
34
- expect(getPath(object, "a.b", "foo")).toBe("foo");
35
- expect(getPath(object, "a.b?.c", "bar")).toBe("bar");
36
- });
37
- test("returns the initial object if path is empty", function () {
38
- var object = {
39
- a: {},
40
- };
41
- expect(getPath(object, "")).toBe(object);
42
- });
43
- });
44
- //# sourceMappingURL=get-path.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-path.spec.js","sourceRoot":"","sources":["../../../src/object/get-path.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,QAAQ,CAAC,SAAS,EAAE;IAClB,IAAI,CAAC,oCAAoC,EAAE;QACzC,IAAM,MAAM,GAAG;YACb,CAAC,EAAE;gBACD,CAAC,EAAE,GAAG;aACP;SACF,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,sCAAsC,EAAE;QAC3C,IAAM,MAAM,GAAG,CAAC,IAAI;YAClB,CAAC,IAAI;gBACH,IAAI;gBACJ,KAAK,CAAC,CAAC,CAAC;QACZ,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4BAA4B,EAAE;QACjC,IAAM,MAAM,GAAG;YACb,CAAC,EAAE,EAAE;SACN,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,iEAAiE,EAAE;QACtE,IAAM,MAAM,GAAG;YACb,CAAC,EAAE,EAAE;SACN,CAAC;QACF,MAAM,CAAC,cAAM,OAAA,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,EAAxB,CAAwB,CAAC,CAAC,OAAO,EAAE,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,kDAAkD,EAAE;QACvD,IAAM,MAAM,GAAG;YACb,CAAC,EAAE,EAAE;SACN,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,6CAA6C,EAAE;QAClD,IAAM,MAAM,GAAG;YACb,CAAC,EAAE,EAAE;SACN,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,14 +0,0 @@
1
- export * from "./crumble-path";
2
- export * from "./copy-property";
3
- export * from "./deep-freeze";
4
- export * from "./diff";
5
- export * from "./for-each-entry-deep";
6
- export * from "./for-each-nested-object";
7
- export * from "./get-path";
8
- export * from "./omit";
9
- export * from "./set-path";
10
- export * from "./traverse-path";
11
- export * from "./merge-deep";
12
- export * from "./merge-properties-deep";
13
- export * from "./values";
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/object/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC"}
@@ -1,60 +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 isPlainObject from "lodash.isplainobject";
13
- /**
14
- * Recursive merge of any number of objects
15
- */
16
- export function mergeDeep() {
17
- var e_1, _a, e_2, _b;
18
- var objectsToMerge = [];
19
- for (var _i = 0; _i < arguments.length; _i++) {
20
- objectsToMerge[_i] = arguments[_i];
21
- }
22
- var result = {};
23
- try {
24
- for (var objectsToMerge_1 = __values(objectsToMerge), objectsToMerge_1_1 = objectsToMerge_1.next(); !objectsToMerge_1_1.done; objectsToMerge_1_1 = objectsToMerge_1.next()) {
25
- var mergee = objectsToMerge_1_1.value;
26
- try {
27
- for (var _c = (e_2 = void 0, __values(Object.keys(mergee))), _d = _c.next(); !_d.done; _d = _c.next()) {
28
- var key = _d.value;
29
- if (Object.prototype.hasOwnProperty.call(result, key)
30
- && Object.getOwnPropertyDescriptor(result, key).writable
31
- && isPlainObject(result[key])) {
32
- result[key] = mergeDeep(result[key], mergee[key]);
33
- }
34
- else if (isPlainObject(mergee[key])) {
35
- result[key] = mergeDeep({}, mergee[key]);
36
- }
37
- else {
38
- result[key] = mergee[key];
39
- }
40
- }
41
- }
42
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
43
- finally {
44
- try {
45
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
46
- }
47
- finally { if (e_2) throw e_2.error; }
48
- }
49
- }
50
- }
51
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
52
- finally {
53
- try {
54
- if (objectsToMerge_1_1 && !objectsToMerge_1_1.done && (_a = objectsToMerge_1.return)) _a.call(objectsToMerge_1);
55
- }
56
- finally { if (e_1) throw e_1.error; }
57
- }
58
- return result;
59
- }
60
- //# sourceMappingURL=merge-deep.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge-deep.js","sourceRoot":"","sources":["../../../src/object/merge-deep.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,SAAS;;IAAC,wBAAwB;SAAxB,UAAwB,EAAxB,qBAAwB,EAAxB,IAAwB;QAAxB,mCAAwB;;IAChD,IAAM,MAAM,GAAG,EAAE,CAAC;;QAClB,KAAqB,IAAA,mBAAA,SAAA,cAAc,CAAA,8CAAA,0EAAE;YAAhC,IAAM,MAAM,2BAAA;;gBACf,KAAkB,IAAA,oBAAA,SAAA,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,CAAA,gBAAA,4BAAE;oBAAlC,IAAM,GAAG,WAAA;oBACZ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;2BACxC,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ;2BACrD,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EACrC;wBACA,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;qBACnD;yBAAM,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;wBACrC,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;qBAC1C;yBAAM;wBACL,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;qBAC3B;iBACF;;;;;;;;;SACF;;;;;;;;;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,16 +0,0 @@
1
- import { mergeDeep } from "./merge-deep";
2
- describe("mergeDeep", function () {
3
- test("should recursively merge objects", function () {
4
- var obj1 = { a: 0, b: { c: 1 } };
5
- var obj2 = { b: { d: 2 }, e: 3 };
6
- expect(mergeDeep(obj1, obj2)).toEqual({
7
- a: 0,
8
- b: {
9
- c: 1,
10
- d: 2,
11
- },
12
- e: 3,
13
- });
14
- });
15
- });
16
- //# sourceMappingURL=merge-deep.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge-deep.spec.js","sourceRoot":"","sources":["../../../src/object/merge-deep.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,QAAQ,CAAC,WAAW,EAAE;IACpB,IAAI,CAAC,kCAAkC,EAAE;QACvC,IAAM,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAM,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;YACpC,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE;gBACD,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;aACL;YACD,CAAC,EAAE,CAAC;SACL,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,61 +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 isPlainObject from "lodash.isplainobject";
13
- import { copyProperty } from "./copy-property";
14
- /**
15
- * Recursive merge of any number of objects using `copyProperty()` rather than assignment
16
- */
17
- export function mergePropertiesDeep() {
18
- var e_1, _a, e_2, _b;
19
- var objectsToMerge = [];
20
- for (var _i = 0; _i < arguments.length; _i++) {
21
- objectsToMerge[_i] = arguments[_i];
22
- }
23
- var result = {};
24
- try {
25
- for (var objectsToMerge_1 = __values(objectsToMerge), objectsToMerge_1_1 = objectsToMerge_1.next(); !objectsToMerge_1_1.done; objectsToMerge_1_1 = objectsToMerge_1.next()) {
26
- var mergee = objectsToMerge_1_1.value;
27
- try {
28
- for (var _c = (e_2 = void 0, __values(Object.keys(mergee))), _d = _c.next(); !_d.done; _d = _c.next()) {
29
- var key = _d.value;
30
- if (Object.prototype.hasOwnProperty.call(result, key)
31
- && Object.getOwnPropertyDescriptor(result, key).writable
32
- && isPlainObject(result[key])) {
33
- result[key] = mergePropertiesDeep(result[key], mergee[key]);
34
- }
35
- else if (isPlainObject(mergee[key])) {
36
- result[key] = mergePropertiesDeep({}, mergee[key]);
37
- }
38
- else {
39
- copyProperty(key, mergee, result);
40
- }
41
- }
42
- }
43
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
44
- finally {
45
- try {
46
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
47
- }
48
- finally { if (e_2) throw e_2.error; }
49
- }
50
- }
51
- }
52
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
53
- finally {
54
- try {
55
- if (objectsToMerge_1_1 && !objectsToMerge_1_1.done && (_a = objectsToMerge_1.return)) _a.call(objectsToMerge_1);
56
- }
57
- finally { if (e_1) throw e_1.error; }
58
- }
59
- return result;
60
- }
61
- //# sourceMappingURL=merge-properties-deep.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge-properties-deep.js","sourceRoot":"","sources":["../../../src/object/merge-properties-deep.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;GAEG;AACH,MAAM,UAAU,mBAAmB;;IAAC,wBAAwB;SAAxB,UAAwB,EAAxB,qBAAwB,EAAxB,IAAwB;QAAxB,mCAAwB;;IAC1D,IAAM,MAAM,GAAG,EAAE,CAAC;;QAClB,KAAqB,IAAA,mBAAA,SAAA,cAAc,CAAA,8CAAA,0EAAE;YAAhC,IAAM,MAAM,2BAAA;;gBACf,KAAkB,IAAA,oBAAA,SAAA,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,CAAA,gBAAA,4BAAE;oBAAlC,IAAM,GAAG,WAAA;oBACZ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;2BACxC,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ;2BACrD,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EACrC;wBACA,MAAM,CAAC,GAAG,CAAC,GAAG,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;qBAC7D;yBAAM,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;wBACrC,MAAM,CAAC,GAAG,CAAC,GAAG,mBAAmB,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;qBACpD;yBAAM;wBACL,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;qBACnC;iBACF;;;;;;;;;SACF;;;;;;;;;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,24 +0,0 @@
1
- import { mergePropertiesDeep } from "./merge-properties-deep";
2
- describe("mergePropertiesDeep", function () {
3
- test("recursively merges properties using copyProperty()", function () {
4
- var objectA = {
5
- a: 1,
6
- b: { n: 2 },
7
- };
8
- var objectB = {
9
- a: 4,
10
- b: {
11
- get nn() {
12
- return this.n * this.n;
13
- },
14
- },
15
- c: 3,
16
- };
17
- var result = mergePropertiesDeep(objectA, objectB);
18
- expect(result.a).toBe(4);
19
- expect(result.b.n).toBe(2);
20
- expect(result.b.nn).toBe(4);
21
- expect(result.c).toBe(3);
22
- });
23
- });
24
- //# sourceMappingURL=merge-properties-deep.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge-properties-deep.spec.js","sourceRoot":"","sources":["../../../src/object/merge-properties-deep.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,QAAQ,CAAC,qBAAqB,EAAE;IAC9B,IAAI,CAAC,oDAAoD,EAAE;QACzD,IAAM,OAAO,GAAG;YACd,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE;SACZ,CAAC;QACF,IAAM,OAAO,GAAG;YACd,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE;gBACD,IAAI,EAAE;oBACJ,OAAO,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;gBACzB,CAAC;aACF;YACD,CAAC,EAAE,CAAC;SACL,CAAC;QACF,IAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAErD,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -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,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,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 ".concat(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,2DAAoD,MAAM,CAAC,KAAK,CAAC,CAAE,CAAC,CAAC;aACtF;SACF;;;;;;;;;IAED,OAAO,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;AACjC,CAAC"}
@@ -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,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,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"}