@ts-fns/stdlib 0.1.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 (135) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +132 -0
  3. package/dist/array/index.cjs +551 -0
  4. package/dist/array/index.cjs.map +1 -0
  5. package/dist/array/index.d.cts +334 -0
  6. package/dist/array/index.d.cts.map +1 -0
  7. package/dist/array/index.d.mts +334 -0
  8. package/dist/array/index.d.mts.map +1 -0
  9. package/dist/array/index.mjs +498 -0
  10. package/dist/array/index.mjs.map +1 -0
  11. package/dist/errors-CJsLpYo9.d.cts +25 -0
  12. package/dist/errors-CJsLpYo9.d.cts.map +1 -0
  13. package/dist/errors-CJsLpYo9.d.mts +25 -0
  14. package/dist/errors-CJsLpYo9.d.mts.map +1 -0
  15. package/dist/errors-Dw1kitu_.mjs +39 -0
  16. package/dist/errors-Dw1kitu_.mjs.map +1 -0
  17. package/dist/errors-O-d_Vemi.cjs +74 -0
  18. package/dist/errors-O-d_Vemi.cjs.map +1 -0
  19. package/dist/function/index.cjs +15 -0
  20. package/dist/function/index.d.cts +107 -0
  21. package/dist/function/index.d.cts.map +1 -0
  22. package/dist/function/index.d.mts +107 -0
  23. package/dist/function/index.d.mts.map +1 -0
  24. package/dist/function/index.mjs +3 -0
  25. package/dist/function-CB82a2GS.cjs +186 -0
  26. package/dist/function-CB82a2GS.cjs.map +1 -0
  27. package/dist/function-DnI2v0p3.mjs +121 -0
  28. package/dist/function-DnI2v0p3.mjs.map +1 -0
  29. package/dist/get-CWL_cu6G.mjs +27 -0
  30. package/dist/get-CWL_cu6G.mjs.map +1 -0
  31. package/dist/get-yrs1Kqho.cjs +38 -0
  32. package/dist/get-yrs1Kqho.cjs.map +1 -0
  33. package/dist/guard/index.cjs +43 -0
  34. package/dist/guard/index.cjs.map +1 -0
  35. package/dist/guard/index.d.cts +52 -0
  36. package/dist/guard/index.d.cts.map +1 -0
  37. package/dist/guard/index.d.mts +52 -0
  38. package/dist/guard/index.d.mts.map +1 -0
  39. package/dist/guard/index.mjs +40 -0
  40. package/dist/guard/index.mjs.map +1 -0
  41. package/dist/index-BJlKyBJH.d.cts +18 -0
  42. package/dist/index-BJlKyBJH.d.cts.map +1 -0
  43. package/dist/index-DGrnGMDt.d.mts +18 -0
  44. package/dist/index-DGrnGMDt.d.mts.map +1 -0
  45. package/dist/isNotNil-DrF-ohem.cjs +28 -0
  46. package/dist/isNotNil-DrF-ohem.cjs.map +1 -0
  47. package/dist/isNotNil-R5f1hC53.mjs +23 -0
  48. package/dist/isNotNil-R5f1hC53.mjs.map +1 -0
  49. package/dist/iterator/index.cjs +160 -0
  50. package/dist/iterator/index.cjs.map +1 -0
  51. package/dist/iterator/index.d.cts +71 -0
  52. package/dist/iterator/index.d.cts.map +1 -0
  53. package/dist/iterator/index.d.mts +71 -0
  54. package/dist/iterator/index.d.mts.map +1 -0
  55. package/dist/iterator/index.mjs +148 -0
  56. package/dist/iterator/index.mjs.map +1 -0
  57. package/dist/lens/index.cjs +199 -0
  58. package/dist/lens/index.cjs.map +1 -0
  59. package/dist/lens/index.d.cts +109 -0
  60. package/dist/lens/index.d.cts.map +1 -0
  61. package/dist/lens/index.d.mts +109 -0
  62. package/dist/lens/index.d.mts.map +1 -0
  63. package/dist/lens/index.mjs +187 -0
  64. package/dist/lens/index.mjs.map +1 -0
  65. package/dist/map/index.cjs +86 -0
  66. package/dist/map/index.cjs.map +1 -0
  67. package/dist/map/index.d.cts +41 -0
  68. package/dist/map/index.d.cts.map +1 -0
  69. package/dist/map/index.d.mts +41 -0
  70. package/dist/map/index.d.mts.map +1 -0
  71. package/dist/map/index.mjs +75 -0
  72. package/dist/map/index.mjs.map +1 -0
  73. package/dist/number/index.cjs +179 -0
  74. package/dist/number/index.cjs.map +1 -0
  75. package/dist/number/index.d.cts +112 -0
  76. package/dist/number/index.d.cts.map +1 -0
  77. package/dist/number/index.d.mts +112 -0
  78. package/dist/number/index.d.mts.map +1 -0
  79. package/dist/number/index.mjs +159 -0
  80. package/dist/number/index.mjs.map +1 -0
  81. package/dist/object/index.cjs +190 -0
  82. package/dist/object/index.cjs.map +1 -0
  83. package/dist/object/index.d.cts +118 -0
  84. package/dist/object/index.d.cts.map +1 -0
  85. package/dist/object/index.d.mts +118 -0
  86. package/dist/object/index.d.mts.map +1 -0
  87. package/dist/object/index.mjs +169 -0
  88. package/dist/object/index.mjs.map +1 -0
  89. package/dist/orThrow-V91Jw2lF.mjs +15 -0
  90. package/dist/orThrow-V91Jw2lF.mjs.map +1 -0
  91. package/dist/orThrow-ejzcQYAI.cjs +20 -0
  92. package/dist/orThrow-ejzcQYAI.cjs.map +1 -0
  93. package/dist/order/index.cjs +50 -0
  94. package/dist/order/index.cjs.map +1 -0
  95. package/dist/order/index.d.cts +3 -0
  96. package/dist/order/index.d.mts +3 -0
  97. package/dist/order/index.mjs +42 -0
  98. package/dist/order/index.mjs.map +1 -0
  99. package/dist/order.constants-BWSCg3C7.d.cts +11 -0
  100. package/dist/order.constants-BWSCg3C7.d.cts.map +1 -0
  101. package/dist/order.constants-BWSCg3C7.d.mts +11 -0
  102. package/dist/order.constants-BWSCg3C7.d.mts.map +1 -0
  103. package/dist/purry-B2_0DGLV.cjs +28 -0
  104. package/dist/purry-B2_0DGLV.cjs.map +1 -0
  105. package/dist/purry-BOWmqwDB.mjs +23 -0
  106. package/dist/purry-BOWmqwDB.mjs.map +1 -0
  107. package/dist/set/index.cjs +131 -0
  108. package/dist/set/index.cjs.map +1 -0
  109. package/dist/set/index.d.cts +61 -0
  110. package/dist/set/index.d.cts.map +1 -0
  111. package/dist/set/index.d.mts +61 -0
  112. package/dist/set/index.d.mts.map +1 -0
  113. package/dist/set/index.mjs +115 -0
  114. package/dist/set/index.mjs.map +1 -0
  115. package/dist/string/index.cjs +288 -0
  116. package/dist/string/index.cjs.map +1 -0
  117. package/dist/string/index.d.cts +144 -0
  118. package/dist/string/index.d.cts.map +1 -0
  119. package/dist/string/index.d.mts +144 -0
  120. package/dist/string/index.d.mts.map +1 -0
  121. package/dist/string/index.mjs +254 -0
  122. package/dist/string/index.mjs.map +1 -0
  123. package/dist/tuple/index.cjs +135 -0
  124. package/dist/tuple/index.cjs.map +1 -0
  125. package/dist/tuple/index.d.cts +207 -0
  126. package/dist/tuple/index.d.cts.map +1 -0
  127. package/dist/tuple/index.d.mts +207 -0
  128. package/dist/tuple/index.d.mts.map +1 -0
  129. package/dist/tuple/index.mjs +122 -0
  130. package/dist/tuple/index.mjs.map +1 -0
  131. package/dist/types-D8f67ZCe.d.cts +54 -0
  132. package/dist/types-D8f67ZCe.d.cts.map +1 -0
  133. package/dist/types-D8f67ZCe.d.mts +54 -0
  134. package/dist/types-D8f67ZCe.d.mts.map +1 -0
  135. package/package.json +177 -0
@@ -0,0 +1,148 @@
1
+ import { t as purry } from "../purry-BOWmqwDB.mjs";
2
+ import { t as isNotNil } from "../isNotNil-R5f1hC53.mjs";
3
+ //#region src/iterator/_globalAliases.ts
4
+ const { from } = Iterator;
5
+ //#endregion
6
+ //#region src/iterator/drop.ts
7
+ function dropImplementation(iter, limit) {
8
+ try {
9
+ return iter.drop(limit);
10
+ } catch (e) {
11
+ if (e instanceof RangeError) throw new RangeError(`Iter.drop() :: ${e.message}`);
12
+ throw e;
13
+ }
14
+ }
15
+ function drop(...args) {
16
+ return purry(dropImplementation, args);
17
+ }
18
+ //#endregion
19
+ //#region src/iterator/every.ts
20
+ function everyImplementation(data, predicate) {
21
+ return data.every(predicate);
22
+ }
23
+ function every(...args) {
24
+ return purry(everyImplementation, args);
25
+ }
26
+ //#endregion
27
+ //#region src/iterator/filter.ts
28
+ function filterImplementation(data, predicate) {
29
+ return data.filter(predicate);
30
+ }
31
+ function filter(...args) {
32
+ return purry(filterImplementation, args);
33
+ }
34
+ //#endregion
35
+ //#region src/guard/orNull.ts
36
+ /**
37
+ * Normalize nullish values to `null`, leaving all other values unchanged.
38
+ * Equivalent to `value ?? null`.
39
+ *
40
+ * @category Guard
41
+ * @param value - A value that may be `null` or `undefined`.
42
+ * @returns `null` when `value` is `null` or `undefined`; otherwise `value` with `null` and `undefined` removed from its type.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * orNull(0); // 0
47
+ * orNull(undefined); // null
48
+ * orNull(null); // null
49
+ * ```
50
+ */
51
+ function orNull(value) {
52
+ return value ?? null;
53
+ }
54
+ //#endregion
55
+ //#region src/iterator/find.ts
56
+ function findImplementation(data, predicate) {
57
+ return orNull(data.find(predicate));
58
+ }
59
+ function find(...args) {
60
+ return purry(findImplementation, args);
61
+ }
62
+ //#endregion
63
+ //#region src/iterator/flatMap.ts
64
+ function flatMapImplementation(data, fn) {
65
+ return data.flatMap(fn);
66
+ }
67
+ function flatMap(...args) {
68
+ return purry(flatMapImplementation, args);
69
+ }
70
+ //#endregion
71
+ //#region src/iterator/map.ts
72
+ function mapImplementation(data, fn) {
73
+ return data.map(fn);
74
+ }
75
+ function map(...args) {
76
+ return purry(mapImplementation, args);
77
+ }
78
+ //#endregion
79
+ //#region src/iterator/range.ts
80
+ function rangeWithOptsImplementation(start, end, option) {
81
+ if (start === Infinity || start === -Infinity) throw new RangeError(`range() start argument cannot be ${start}`);
82
+ if (Number.isNaN(start)) throw new RangeError(`range() start argument cannot be NaN`);
83
+ if (Number.isNaN(end)) throw new RangeError(`range() end argument cannot be NaN`);
84
+ if (typeof start === "bigint" && isNotNil(option.step) && typeof option.step !== "bigint") throw new RangeError(`range() option.step argument must be of the same type as start`);
85
+ if (isNotNil(option.step) && option.step <= 0) {
86
+ if (option.step < 1) throw new RangeError(`Arr.range() :: ${option.step} must be a positive integer`);
87
+ }
88
+ const { inclusive = false } = option;
89
+ const step = option.step ?? (typeof start === "bigint" ? 1n : 1);
90
+ const isIncreasing = start < end;
91
+ const changeFunc = start < end ? (value) => value + step : (value) => value - step;
92
+ const endCondition = (() => {
93
+ if (isIncreasing && inclusive) return (value) => value <= end;
94
+ if (isIncreasing && !inclusive) return (value) => value < end;
95
+ if (!isIncreasing && inclusive) return (value) => value >= end;
96
+ return (value) => value > end;
97
+ })();
98
+ const gen = function* () {
99
+ let current = start;
100
+ while (endCondition(current)) {
101
+ yield current;
102
+ current = changeFunc(current);
103
+ }
104
+ };
105
+ return gen();
106
+ }
107
+ function rangeImplementation(start, end) {
108
+ return rangeWithOptsImplementation(start, end, {});
109
+ }
110
+ function range(...args) {
111
+ return purry(rangeImplementation, args);
112
+ }
113
+ function rangeWithOpts(...args) {
114
+ return purry(rangeWithOptsImplementation, args);
115
+ }
116
+ //#endregion
117
+ //#region src/iterator/reduce.ts
118
+ function reduceImplementation(data, fn, initialValue) {
119
+ return data.reduce(fn, initialValue);
120
+ }
121
+ function reduce(...args) {
122
+ return purry(reduceImplementation, args);
123
+ }
124
+ //#endregion
125
+ //#region src/iterator/some.ts
126
+ function someImplementation(data, predicate) {
127
+ return data.some(predicate);
128
+ }
129
+ function some(...args) {
130
+ return purry(someImplementation, args);
131
+ }
132
+ //#endregion
133
+ //#region src/iterator/take.ts
134
+ function takeImplementation(iter, limit) {
135
+ try {
136
+ return iter.take(limit);
137
+ } catch (e) {
138
+ if (e instanceof RangeError) throw new RangeError(`Iter.take() :: ${e.message}`);
139
+ throw e;
140
+ }
141
+ }
142
+ function take(...args) {
143
+ return purry(takeImplementation, args);
144
+ }
145
+ //#endregion
146
+ export { drop, every, filter, find, flatMap, from, map, range, rangeWithOpts, reduce, some, take };
147
+
148
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/iterator/_globalAliases.ts","../../src/iterator/drop.ts","../../src/iterator/every.ts","../../src/iterator/filter.ts","../../src/guard/orNull.ts","../../src/iterator/find.ts","../../src/iterator/flatMap.ts","../../src/iterator/map.ts","../../src/iterator/range.ts","../../src/iterator/reduce.ts","../../src/iterator/some.ts","../../src/iterator/take.ts"],"sourcesContent":["// TODO: look into this eslint error\n// eslint-disable-next-line @typescript-eslint/unbound-method\nexport const { from } = Iterator;\n","import { purry } from '../function/purry';\n\nfunction dropImplementation<T>(iter: IteratorObject<T, any, any>, limit: number): IteratorObject<T, undefined> {\n try {\n return iter.drop(limit);\n } catch (e) {\n if (e instanceof RangeError) {\n throw new RangeError(`Iter.drop() :: ${e.message}`);\n }\n throw e;\n }\n}\n\n/**\n * @throws {RangeError}\n */\nexport function drop<T>(limit: number): (iter: IteratorObject<T, any, any>) => IteratorObject<T, undefined>;\nexport function drop<T>(iter: IteratorObject<T, any, any>, limit: number): IteratorObject<T, undefined>;\nexport function drop(...args: readonly unknown[]): unknown {\n return purry(dropImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction everyImplementation<T>(\n data: IteratorObject<T, any, any>,\n predicate: (value: T, index: number) => unknown,\n): boolean {\n return data.every(predicate);\n}\n\nexport function every<T>(\n predicate: (value: T, index: number) => unknown,\n): (data: IteratorObject<T, any, any>) => boolean;\nexport function every<T>(data: IteratorObject<T, any, any>, predicate: (value: T, index: number) => unknown): boolean;\nexport function every(...args: readonly unknown[]): unknown {\n return purry(everyImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction filterImplementation<T>(\n data: IteratorObject<T, any, any>,\n predicate: (value: T, index: number) => boolean,\n): IteratorObject<T, undefined> {\n return data.filter(predicate);\n}\n\nexport function filter<T, S extends T>(\n predicate: (value: T, index: number) => value is S,\n): (data: IteratorObject<T, any, any>) => IteratorObject<S, undefined>;\nexport function filter<T>(\n predicate: (value: T, index: number) => boolean,\n): (data: IteratorObject<T, any, any>) => IteratorObject<T, undefined>;\nexport function filter<T, S extends T>(\n data: IteratorObject<T, any, any>,\n predicate: (value: T, index: number) => value is S,\n): IteratorObject<S, undefined>;\nexport function filter<T>(\n data: IteratorObject<T, any, any>,\n predicate: (value: T, index: number) => boolean,\n): IteratorObject<T, undefined>;\nexport function filter(...args: readonly unknown[]): unknown {\n return purry(filterImplementation, args);\n}\n","/**\n * Normalize nullish values to `null`, leaving all other values unchanged.\n * Equivalent to `value ?? null`.\n *\n * @category Guard\n * @param value - A value that may be `null` or `undefined`.\n * @returns `null` when `value` is `null` or `undefined`; otherwise `value` with `null` and `undefined` removed from its type.\n *\n * @example\n * ```ts\n * orNull(0); // 0\n * orNull(undefined); // null\n * orNull(null); // null\n * ```\n */\nexport function orNull<T>(value: T | null | undefined): NonNullable<T> | null {\n return value ?? null;\n}\n","import { purry } from '../function/purry';\nimport { orNull } from '../guard/orNull';\n\nfunction findImplementation<T>(\n data: IteratorObject<T, any, any>,\n predicate: (value: T, index: number) => boolean,\n): T | null {\n return orNull(data.find(predicate));\n}\n\nexport function find<T, S extends T>(\n predicate: (value: T, index: number) => value is S,\n): (data: IteratorObject<T, any, any>) => S | null;\nexport function find<T>(\n predicate: (value: T, index: number) => boolean,\n): (data: IteratorObject<T, any, any>) => T | null;\nexport function find<T, S extends T>(\n data: IteratorObject<T, any, any>,\n predicate: (value: T, index: number) => value is S,\n): S | null;\nexport function find<T>(data: IteratorObject<T, any, any>, predicate: (value: T, index: number) => boolean): T | null;\nexport function find(...args: readonly unknown[]): unknown {\n return purry(findImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction flatMapImplementation<T, U>(\n data: IteratorObject<T, any, any>,\n fn: (value: T, index: number) => Iterable<U, unknown, undefined> | Iterator<U, unknown, undefined>,\n): IteratorObject<U, undefined> {\n return data.flatMap(fn);\n}\n\nexport function flatMap<T, U>(\n fn: (value: T, index: number) => Iterable<U, unknown, undefined> | Iterator<U, unknown, undefined>,\n): (data: IteratorObject<T, any, any>) => IteratorObject<U, undefined>;\nexport function flatMap<T, U>(\n data: IteratorObject<T, any, any>,\n fn: (value: T, index: number) => Iterable<U, unknown, undefined> | Iterator<U, unknown, undefined>,\n): IteratorObject<U, undefined>;\nexport function flatMap(...args: readonly unknown[]): unknown {\n return purry(flatMapImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction mapImplementation<T, U>(\n data: IteratorObject<T, any, any>,\n fn: (value: T, index: number) => U,\n): IteratorObject<U, undefined> {\n return data.map(fn);\n}\n\nexport function map<T, U>(\n fn: (value: T, index: number) => U,\n): (data: IteratorObject<T, any, any>) => IteratorObject<U, undefined>;\nexport function map<T, U>(\n data: IteratorObject<T, any, any>,\n fn: (value: T, index: number) => U,\n): IteratorObject<U, undefined>;\nexport function map(...args: readonly unknown[]): unknown {\n return purry(mapImplementation, args);\n}\n","import { purry } from '../function/purry';\nimport { isNotNil } from '../guard/isNotNil';\n\n// Take from https://github.com/tc39/proposal-iterator.range/blob/main/global.d.ts\ntype Infinity = number;\ninterface NumericRangeOptions<T extends bigint | number> {\n inclusive?: boolean;\n step?: T;\n}\n\nfunction rangeWithOptsImplementation<T extends bigint | number>(\n start: T,\n end: Infinity | T,\n option: NumericRangeOptions<T>,\n): IteratorObject<T, undefined> {\n if (start === Infinity || start === -Infinity) {\n throw new RangeError(`range() start argument cannot be ${start}`);\n }\n if (Number.isNaN(start)) {\n throw new RangeError(`range() start argument cannot be NaN`);\n }\n if (Number.isNaN(end)) {\n throw new RangeError(`range() end argument cannot be NaN`);\n }\n if (typeof start === 'bigint' && isNotNil(option.step) && typeof option.step !== 'bigint') {\n throw new RangeError(`range() option.step argument must be of the same type as start`);\n }\n if (isNotNil(option.step) && option.step <= 0) {\n if (option.step < 1) {\n throw new RangeError(`Arr.range() :: ${option.step} must be a positive integer`);\n }\n }\n\n const { inclusive = false } = option;\n // typescript cannot correctly narrow that step will always be `T`\n const step = option.step ?? ((typeof start === 'bigint' ? 1n : 1) as unknown as T);\n const isIncreasing = start < end;\n\n // @ts-expect-error - not sure what's going on with the type issues\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands, @typescript-eslint/no-unsafe-return\n const changeFunc = start < end ? (value: T): T => value + step : (value: T): T => value - step;\n const endCondition = (() => {\n if (isIncreasing && inclusive) return (value: T) => value <= end;\n if (isIncreasing && !inclusive) return (value: T) => value < end;\n if (!isIncreasing && inclusive) return (value: T) => value >= end;\n // if (!isIncreasing && !inclusive)\n return (value: T) => value > end;\n })();\n\n const gen = function* () {\n let current = start;\n while (endCondition(current)) {\n yield current;\n current = changeFunc(current);\n }\n return undefined;\n };\n\n return gen();\n}\n\nfunction rangeImplementation<T extends bigint | number>(start: T, end: Infinity | T): IteratorObject<T, undefined> {\n return rangeWithOptsImplementation(start, end, {});\n}\n\n/**\n * @throws {RangeError}\n */\nexport function range(end: Infinity | bigint): {\n (start: bigint): IteratorObject<bigint, undefined>;\n (start: number): IteratorObject<number, undefined>;\n};\nexport function range<T extends bigint | number>(start: T, end: Infinity | T): IteratorObject<T, undefined>;\nexport function range(...args: unknown[]): unknown {\n return purry(rangeImplementation, args);\n}\n\n/**\n * @throws {RangeError}\n */\nexport function rangeWithOpts<T extends bigint | number>(\n end: Infinity | bigint,\n option: NumericRangeOptions<T>,\n): (start: T) => IteratorObject<T, undefined>;\nexport function rangeWithOpts<T extends bigint | number>(\n start: T,\n end: Infinity | T,\n option: NumericRangeOptions<T>,\n): IteratorObject<T, undefined>;\nexport function rangeWithOpts(...args: unknown[]): unknown {\n return purry(rangeWithOptsImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction reduceImplementation<T, U>(\n data: IteratorObject<T, any, any>,\n fn: (previousValue: U, currentValue: T, currentIndex: number) => U,\n initialValue: U,\n): U {\n return data.reduce(fn, initialValue);\n}\n\nexport function reduce<T, U>(\n fn: (previousValue: U, currentValue: T, currentIndex: number) => U,\n initialValue: U,\n): (data: IteratorObject<T, any, any>) => U;\nexport function reduce<T, U>(\n data: IteratorObject<T, any, any>,\n fn: (previousValue: U, currentValue: T, currentIndex: number) => U,\n initialValue: U,\n): U;\nexport function reduce(...args: readonly unknown[]): unknown {\n return purry(reduceImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction someImplementation<T>(\n data: IteratorObject<T, any, any>,\n predicate: (value: T, index: number) => unknown,\n): boolean {\n return data.some(predicate);\n}\n\nexport function some<T>(\n predicate: (value: T, index: number) => unknown,\n): (data: IteratorObject<T, any, any>) => boolean;\nexport function some<T>(data: IteratorObject<T, any, any>, predicate: (value: T, index: number) => unknown): boolean;\nexport function some(...args: readonly unknown[]): unknown {\n return purry(someImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction takeImplementation<T>(iter: IteratorObject<T, any, any>, limit: number): IteratorObject<T, undefined> {\n try {\n return iter.take(limit);\n } catch (e) {\n if (e instanceof RangeError) {\n throw new RangeError(`Iter.take() :: ${e.message}`);\n }\n throw e;\n }\n}\n\n/**\n * @throws {RangerError}\n */\nexport function take<T>(limit: number): (data: IteratorObject<T, any, any>) => IteratorObject<T, undefined>;\nexport function take<T>(data: IteratorObject<T, any, any>, limit: number): IteratorObject<T, undefined>;\nexport function take(...args: readonly unknown[]): unknown {\n return purry(takeImplementation, args);\n}\n"],"mappings":"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"}
@@ -0,0 +1,199 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_purry = require("../purry-B2_0DGLV.cjs");
3
+ const require_errors = require("../errors-O-d_Vemi.cjs");
4
+ const require_function = require("../function-CB82a2GS.cjs");
5
+ const require_array_index = require("../array/index.cjs");
6
+ const require_get = require("../get-yrs1Kqho.cjs");
7
+ //#region src/lens/lens.ts
8
+ function lens(getter, setter) {
9
+ return (toFunctorFn) => {
10
+ return (source) => {
11
+ return toFunctorFn(getter(source)).map((focus) => {
12
+ return setter(focus, source);
13
+ });
14
+ };
15
+ };
16
+ }
17
+ //#endregion
18
+ //#region src/lens/internal/_idx.ts
19
+ function idxImplementation(index) {
20
+ const getter = (source) => {
21
+ return require_array_index.at(source, index);
22
+ };
23
+ const setter = (focus, source) => {
24
+ return require_array_index.insert(source, index, focus);
25
+ };
26
+ return lens(getter, setter);
27
+ }
28
+ //#endregion
29
+ //#region src/lens/idx.ts
30
+ function idx(index) {
31
+ return idxImplementation(index);
32
+ }
33
+ function idxOrImplementation(index, defaultValue) {
34
+ const getter = (source) => {
35
+ return require_array_index.at(source, index) ?? defaultValue;
36
+ };
37
+ const setter = (focus, source) => {
38
+ return require_array_index.insert(source, index, focus);
39
+ };
40
+ return lens(getter, setter);
41
+ }
42
+ function idxOr(...args) {
43
+ return require_purry.purry(idxOrImplementation, args);
44
+ }
45
+ idx.or = idxOr;
46
+ //#endregion
47
+ //#region src/lens/iso.ts
48
+ function iso(to, from) {
49
+ return lens(to, (focus) => from(focus));
50
+ }
51
+ //#endregion
52
+ //#region src/lens/internal/_lens.ts
53
+ /**
54
+ * Function constructor for a Const functor.
55
+ * Const's map func ignores it's given fn, returning itself.
56
+ * In other words, the value contained is constant from initial construction)
57
+ *
58
+ * Typing for this is impossible with Higher-Kinded-Types
59
+ */
60
+ function Const(value) {
61
+ return {
62
+ map(_fn) {
63
+ return this;
64
+ },
65
+ get value() {
66
+ return value;
67
+ }
68
+ };
69
+ }
70
+ /**
71
+ * Function constructor for an Identity Functor
72
+ * This is the most basic functor you can map, simply changing the value contained per the map fn it receives
73
+ */
74
+ function Identity(value) {
75
+ return {
76
+ map(fn) {
77
+ return Identity(fn(value));
78
+ },
79
+ get value() {
80
+ return value;
81
+ }
82
+ };
83
+ }
84
+ function overImplementation(lens) {
85
+ return function innerOverOntoLens(source, updateFn) {
86
+ return lens(require_function.piped(updateFn, Identity))(source).value;
87
+ };
88
+ }
89
+ //#endregion
90
+ //#region src/lens/over.ts
91
+ function over(lens) {
92
+ return function overOntoLens(...args) {
93
+ return require_purry.purry(overImplementation(lens), args);
94
+ };
95
+ }
96
+ //#endregion
97
+ //#region src/lens/internal/_path.ts
98
+ function pathImplementation(obj, keys) {
99
+ const len = keys.length;
100
+ if (len === 0) throw new RangeError("Lens.path does not support passing in an empty keys array");
101
+ if (obj == null) throw new require_errors.NilError("Lens.path does not support passing null or undefined");
102
+ let result = obj;
103
+ for (let i = 0; i < len; i += 1) {
104
+ const key = keys[i];
105
+ if (typeof key === "number") result = require_array_index.at(result, key);
106
+ else result = require_get.get(result, key);
107
+ }
108
+ return result;
109
+ }
110
+ function pathOrImplementation(obj, pathway, defaultValue) {
111
+ const result = pathImplementation(obj, pathway);
112
+ if (result instanceof require_errors.NotFoundError) return defaultValue;
113
+ return result;
114
+ }
115
+ //#endregion
116
+ //#region src/lens/path.ts
117
+ function path(...args) {
118
+ return require_purry.purry(pathImplementation, args);
119
+ }
120
+ //#endregion
121
+ //#region src/lens/pathUnsafe.ts
122
+ function pathUnsafe(...args) {
123
+ return require_purry.purry(pathImplementation, args);
124
+ }
125
+ //#endregion
126
+ //#region src/lens/pathOr.ts
127
+ function pathOr(...args) {
128
+ return require_purry.purry(pathOrImplementation, args);
129
+ }
130
+ //#endregion
131
+ //#region src/lens/pathOrUnsafe.ts
132
+ function pathOrUnsafe(...args) {
133
+ return require_purry.purry(pathOrImplementation, args);
134
+ }
135
+ //#endregion
136
+ //#region src/lens/prop.ts
137
+ function prop(key) {
138
+ const getter = (data) => {
139
+ return data[key];
140
+ };
141
+ const setter = (value, data) => {
142
+ return {
143
+ ...data,
144
+ [key]: value
145
+ };
146
+ };
147
+ return lens(getter, setter);
148
+ }
149
+ prop.or = function propOr(key, defaultValue) {
150
+ const getter = (data) => {
151
+ return data[key] ?? defaultValue;
152
+ };
153
+ const setter = (value, data) => {
154
+ return {
155
+ ...data,
156
+ [key]: value
157
+ };
158
+ };
159
+ return lens(getter, setter);
160
+ };
161
+ //#endregion
162
+ //#region src/lens/set.ts
163
+ function setImplementation(lens) {
164
+ return function innerSetOntoLens(source, value) {
165
+ return overImplementation(lens)(source, () => value);
166
+ };
167
+ }
168
+ function set(lens) {
169
+ return function setOntoLens(...args) {
170
+ return require_purry.purry(setImplementation(lens), args);
171
+ };
172
+ }
173
+ //#endregion
174
+ //#region src/lens/tuple.ts
175
+ function tuple(index) {
176
+ return idxImplementation(index);
177
+ }
178
+ //#endregion
179
+ //#region src/lens/view.ts
180
+ function view(lens) {
181
+ return function viewOntoLens(source) {
182
+ return lens(Const)(source).value;
183
+ };
184
+ }
185
+ //#endregion
186
+ exports.idx = idx;
187
+ exports.iso = iso;
188
+ exports.lens = lens;
189
+ exports.over = over;
190
+ exports.path = path;
191
+ exports.pathOr = pathOr;
192
+ exports.pathOrUnsafe = pathOrUnsafe;
193
+ exports.pathUnsafe = pathUnsafe;
194
+ exports.prop = prop;
195
+ exports.set = set;
196
+ exports.tuple = tuple;
197
+ exports.view = view;
198
+
199
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["purry","piped","purry","NilError","at","get","NotFoundError","purry","purry","purry","purry","purry"],"sources":["../../src/lens/lens.ts","../../src/lens/internal/_idx.ts","../../src/lens/idx.ts","../../src/lens/iso.ts","../../src/lens/internal/_lens.ts","../../src/lens/over.ts","../../src/lens/internal/_path.ts","../../src/lens/path.ts","../../src/lens/pathUnsafe.ts","../../src/lens/pathOr.ts","../../src/lens/pathOrUnsafe.ts","../../src/lens/prop.ts","../../src/lens/set.ts","../../src/lens/tuple.ts","../../src/lens/view.ts"],"sourcesContent":["import type { Functor, Lens } from './internal/_lens';\n\nexport function lens<Source, Focus>(\n getter: (source: Source) => Focus,\n setter: (focus: Focus, source: Source) => Source,\n): Lens<Source, Focus> {\n return (toFunctorFn: (focus: Focus) => Functor<Focus>): ((source: Source) => Functor<Source>) => {\n return (source: Source): Functor<Source> => {\n const got = getter(source);\n return toFunctorFn(got).map(focus => {\n return setter(focus, source);\n });\n };\n };\n}\n","import * as Arr from '../../array';\nimport { lens } from '../lens';\n\nimport type { Lens } from './_lens';\n\nexport function idxImplementation<T>(index: number): Lens<T[], T> {\n const getter = (source: T[]): T => {\n const value = Arr.at(source, index);\n return value as T;\n };\n\n const setter = (focus: T, source: T[]): T[] => {\n const updatedSource = Arr.insert(source, index, focus);\n return updatedSource;\n };\n\n return lens(getter, setter);\n}\n","import * as Arr from '../array';\nimport { purry } from '../function';\nimport type { Accessed } from '../types';\n\nimport { idxImplementation } from './internal/_idx';\nimport type { Lens } from './internal/_lens';\nimport { lens } from './lens';\n\nexport function idx<T>(index: number): Lens<T[], Accessed<T>> {\n return idxImplementation(index) as Lens<T[], Accessed<T>>;\n}\n\nfunction idxOrImplementation<T>(index: number, defaultValue: T): Lens<T[], T> {\n const getter = (source: T[]): T => {\n const value = Arr.at(source, index);\n return (value as T) ?? defaultValue;\n };\n\n const setter = (focus: T, source: T[]): T[] => {\n const updatedSource = Arr.insert(source, index, focus);\n return updatedSource;\n };\n\n return lens(getter, setter);\n}\n\nfunction idxOr<T>(index: number, defaultValue: T): Lens<T[], T>;\nfunction idxOr(...args: readonly unknown[]): unknown {\n return purry(idxOrImplementation, args);\n}\n\nidx.or = idxOr;\n","import type { Lens } from './internal/_lens';\nimport { lens } from './lens';\n\nexport function iso<A, B>(to: (a: A) => B, from: (b: B) => A): Lens<A, B> {\n // by ignoring `source` in the setter, we are effectively transforming on _self_\n return lens(to, focus => from(focus));\n}\n","import { piped } from '../../function/piped';\n\nexport interface Functor<A> {\n map<B>(fn: (a: A) => B): Functor<B>;\n get value(): A;\n}\n\nexport type Lens<Source, Focus> = (\n functorFactory: (focus: Focus) => Functor<Focus>,\n) => (source: Source) => Functor<Source>;\n\n/**\n * Function constructor for a Const functor.\n * Const's map func ignores it's given fn, returning itself.\n * In other words, the value contained is constant from initial construction)\n *\n * Typing for this is impossible with Higher-Kinded-Types\n */\nexport function Const(value: unknown): Functor<unknown> {\n const functor: Functor<unknown> = {\n map(this: Functor<unknown>, _fn: (value: unknown) => unknown): Functor<any> {\n return this;\n },\n get value() {\n return value;\n },\n };\n return functor;\n}\n\n/**\n * Function constructor for an Identity Functor\n * This is the most basic functor you can map, simply changing the value contained per the map fn it receives\n */\nexport function Identity<A>(value: A): Functor<A> {\n return {\n map<B>(fn: (value: A) => B): Functor<B> {\n return Identity(fn(value));\n },\n get value() {\n return value;\n },\n };\n}\n\nexport function overImplementation<Source, Focus>(\n lens: Lens<Source, Focus>,\n): (source: Source, updateFn: (value: Focus) => Focus) => Source {\n return function innerOverOntoLens(source, updateFn) {\n const temp = piped(updateFn, Identity);\n // @ts-expect-error - types will never be correct here because of how Identity works\n return lens(temp)(source).value;\n };\n}\n","import { purry } from '../function';\n\nimport type { Lens } from './internal/_lens';\nimport { overImplementation } from './internal/_lens';\n\nexport function over<Source, Focus>(\n lens: Lens<Source, Focus>,\n): {\n (updateFn: (value: Focus) => Focus): (source: Source) => Source;\n (source: Source, updateFn: (value: Focus) => Focus): Source;\n};\nexport function over<Source, Focus>(lens: Lens<Source, Focus>): unknown {\n return function overOntoLens(...args: unknown[]): unknown {\n return purry(overImplementation(lens), args);\n };\n}\n","import { at } from '../../array/at';\nimport { NilError, NotFoundError } from '../../errors';\nimport { get } from '../../object/get';\n\nexport type ValueAtPath<Obj, Tuple extends readonly PropertyKey[]> = Tuple extends readonly [infer Key, ...unknown[]]\n ? Tuple extends readonly [unknown, ...infer Rest]\n ? Key extends keyof Obj\n ? Rest extends []\n ? NonNullable<Obj[Key]>\n : Rest extends readonly PropertyKey[]\n ? ValueAtPath<NonNullable<Required<Obj>[Key]>, Rest>\n : never\n : never\n : never\n : never;\n\nexport function pathImplementation(obj: object | null | undefined, keys: (number | string)[]): unknown {\n const len = keys.length;\n if (len === 0) {\n throw new RangeError('Lens.path does not support passing in an empty keys array');\n }\n\n if (obj == null) {\n throw new NilError('Lens.path does not support passing null or undefined');\n }\n\n let result: unknown = obj;\n\n for (let i = 0; i < len; i += 1) {\n const key = keys[i]!;\n\n if (typeof key === 'number') {\n result = at(result as any[], key);\n } else {\n result = get(result as Record<string, unknown>, key);\n }\n }\n\n return result;\n}\n\nexport function pathOrImplementation(obj: object, pathway: (number | string)[], defaultValue: unknown): unknown {\n const result = pathImplementation(obj, pathway);\n if (result instanceof NotFoundError) {\n return defaultValue;\n }\n return result;\n}\n","import { purry } from '../function/purry';\n\nimport type { ValueAtPath } from './internal/_path';\nimport { pathImplementation } from './internal/_path';\n\n/**\n *\n * @throws RangeError\n */\nexport function path(path: readonly []): never;\nexport function path<Obj extends object, K1 extends keyof Required<Obj>>(\n path: readonly [K1],\n): (data: Obj) => ValueAtPath<Obj, [K1]> | null;\nexport function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>>(\n path: readonly [K1, K2],\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n>(path: readonly [K1, K2, K3]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n>(path: readonly [K1, K2, K3, K4]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n>(path: readonly [K1, K2, K3, K4, K5]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n>(path: readonly [K1, K2, K3, K4, K5, K6]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n>(path: readonly [K1, K2, K3, K4, K5, K6, K7]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>,\n>(\n path: readonly [K1, K2, K3, K4, K5, K6, K7, K8],\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>,\n K9 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>>,\n>(\n path: readonly [K1, K2, K3, K4, K5, K6, K7, K8, K9],\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]> | null;\nexport function path<const P extends readonly PropertyKey[]>(\n path: P,\n): <S extends object>(data: S) => never extends ValueAtPath<S, P> ? ValueAtPath<S, P> | null : never;\n\nexport function path(obj: unknown, path: readonly []): never;\nexport function path<Obj, K1 extends keyof Required<Obj>>(obj: Obj, path: readonly [K1]): ValueAtPath<Obj, [K1]> | null;\nexport function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>>(\n obj: Obj,\n path: readonly [K1, K2],\n): ValueAtPath<Obj, [K1, K2]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n>(obj: Obj, path: readonly [K1, K2, K3]): ValueAtPath<Obj, [K1, K2, K3]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n>(obj: Obj, path: readonly [K1, K2, K3, K4]): ValueAtPath<Obj, [K1, K2, K3, K4]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n>(obj: Obj, path: readonly [K1, K2, K3, K4, K5]): ValueAtPath<Obj, [K1, K2, K3, K4, K5]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6]): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6, K7]): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>,\n>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6, K7, K8]): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]> | null;\nexport function path<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>,\n K9 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>>,\n>(\n obj: Obj,\n path: readonly [K1, K2, K3, K4, K5, K6, K7, K8, K9],\n): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]> | null;\nexport function path(...args: unknown[]): unknown {\n return purry(pathImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nimport { pathImplementation } from './internal/_path';\n\nexport function pathUnsafe<T = unknown>(path: readonly PropertyKey[]): (data: object) => T | null;\nexport function pathUnsafe<T = unknown>(data: object, path: readonly PropertyKey[]): T | null;\nexport function pathUnsafe(...args: unknown[]): unknown {\n return purry(pathImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nimport type { ValueAtPath } from './internal/_path';\nimport { pathOrImplementation } from './internal/_path';\n\nexport function pathOr(path: readonly [], defaultValue: unknown): never;\nexport function pathOr<Obj extends object, K1 extends keyof Required<Obj>>(\n path: readonly [K1],\n defaultValue: ValueAtPath<Obj, [K1]>,\n): (data: Obj) => ValueAtPath<Obj, [K1]>;\nexport function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>>(\n path: readonly [K1, K2],\n defaultValue: ValueAtPath<Obj, [K1, K2]>,\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n>(\n path: readonly [K1, K2, K3],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3]>,\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n>(\n path: readonly [K1, K2, K3, K4],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4]>,\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n>(\n path: readonly [K1, K2, K3, K4, K5],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5]>,\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n>(\n path: readonly [K1, K2, K3, K4, K5, K6],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>,\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n>(\n path: readonly [K1, K2, K3, K4, K5, K6, K7],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>,\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>,\n>(\n path: readonly [K1, K2, K3, K4, K5, K6, K7, K8],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>,\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>,\n K9 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>>,\n>(\n path: readonly [K1, K2, K3, K4, K5, K6, K7, K8, K9],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]>,\n): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]>;\nexport function pathOr<const Path extends readonly PropertyKey[], Value>(\n pathway: Path,\n defaultValue: Value,\n): <Obj extends object>(obj: Value extends ValueAtPath<Obj, Path> ? Obj : never) => ValueAtPath<Obj, Path>;\n\nexport function pathOr(obj: unknown, path: readonly [], defaultValue: unknown): never;\nexport function pathOr<Obj, K1 extends keyof Required<Obj>>(\n obj: Obj,\n path: readonly [K1],\n defaultValue: ValueAtPath<Obj, [K1]>,\n): ValueAtPath<Obj, [K1]>;\nexport function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>>(\n obj: Obj,\n path: readonly [K1, K2],\n defaultValue: ValueAtPath<Obj, [K1, K2]>,\n): ValueAtPath<Obj, [K1, K2]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n>(obj: Obj, path: readonly [K1, K2, K3], defaultValue: ValueAtPath<Obj, [K1, K2, K3]>): ValueAtPath<Obj, [K1, K2, K3]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n>(\n obj: Obj,\n path: readonly [K1, K2, K3, K4],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4]>,\n): ValueAtPath<Obj, [K1, K2, K3, K4]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n>(\n obj: Obj,\n path: readonly [K1, K2, K3, K4, K5],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5]>,\n): ValueAtPath<Obj, [K1, K2, K3, K4, K5]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n>(\n obj: Obj,\n path: readonly [K1, K2, K3, K4, K5, K6],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>,\n): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n>(\n obj: Obj,\n path: readonly [K1, K2, K3, K4, K5, K6, K7],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>,\n): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>,\n>(\n obj: Obj,\n path: readonly [K1, K2, K3, K4, K5, K6, K7, K8],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>,\n): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>;\nexport function pathOr<\n Obj,\n K1 extends keyof Required<Obj>,\n K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>,\n K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>,\n K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>,\n K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>,\n K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>,\n K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>,\n K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>,\n K9 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>>,\n>(\n obj: Obj,\n path: readonly [K1, K2, K3, K4, K5, K6, K7, K8, K9],\n defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]>,\n): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]>;\nexport function pathOr(...args: unknown[]): unknown {\n return purry(pathOrImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nimport { pathOrImplementation } from './internal/_path';\n\nexport function pathOrUnsafe<T = unknown>(path: readonly PropertyKey[], defaultValue: T): (data: object) => T;\nexport function pathOrUnsafe<T = unknown>(data: object, path: readonly PropertyKey[], defaultValue: T): T;\nexport function pathOrUnsafe(...args: unknown[]): unknown {\n return purry(pathOrImplementation, args);\n}\n","import type { Lens } from './internal/_lens';\nimport { lens } from './lens';\n\nexport function prop<Obj extends Record<string, unknown>, Key extends keyof Obj>(\n key: string extends keyof Obj ? never : Key,\n): Lens<Obj, Obj[Key]>;\nexport function prop<Obj extends Record<string, unknown>>(key: string): Lens<Obj, Obj[string] | undefined>;\nexport function prop<Obj extends Record<string, unknown>>(key: string): Lens<Obj, Obj[string] | undefined> {\n const getter = (data: Obj): Obj[string] | undefined => {\n return data[key] as Obj[string] | undefined;\n };\n\n const setter = (value: Obj[string] | undefined, data: Obj): Obj => {\n return { ...data, [key]: value };\n };\n\n const theLens = lens(getter, setter);\n return theLens;\n}\n\nprop.or = function propOr<Obj extends object, Key extends keyof Obj>(key: Key, defaultValue: NonNullable<Obj[Key]>) {\n const getter = (data: Obj): NonNullable<Obj[Key]> => {\n return data[key] ?? defaultValue;\n };\n const setter = (value: Obj[Key], data: Obj): Obj => {\n return { ...data, [key]: value };\n };\n\n return lens(getter, setter);\n};\n","import { purry } from '../function/purry';\n\nimport type { Lens } from './internal/_lens';\nimport { overImplementation } from './internal/_lens';\n\nfunction setImplementation<Source, Focus>(lens: Lens<Source, Focus>): (source: Source, value: Focus) => Source {\n return function innerSetOntoLens(source, value) {\n return overImplementation(lens)(source, () => value);\n };\n}\n\nexport function set<Source, Focus>(lens: Lens<Source, Focus>): (source: Source, value: Focus) => Source;\nexport function set<Source, Focus>(lens: Lens<Source, Focus>, source: Source, value: Focus): Source;\nexport function set<Source, Focus>(lens: Lens<Source, Focus>): unknown {\n return function setOntoLens(...args: unknown[]): unknown {\n return purry(setImplementation(lens), args);\n };\n}\n","import { idxImplementation } from './internal/_idx';\nimport type { Lens } from './internal/_lens';\n\nexport function tuple<A, B>(index: 0): Lens<[A, B], A>;\nexport function tuple<A, B>(index: 1): Lens<[A, B], B>;\nexport function tuple(index: number): unknown {\n return idxImplementation(index);\n}\n","import type { Lens } from './internal/_lens';\nimport { Const } from './internal/_lens';\n\nexport function view<Source, Focus>(lens: Lens<Source, Focus>): (source: Source) => Focus {\n return function viewOntoLens(source: Source): Focus {\n // @ts-expect-error - types will never be correct here because of how Const works\n return lens(Const)(source).value;\n };\n}\n"],"mappings":"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"}
@@ -0,0 +1,109 @@
1
+ import { t as Accessed } from "../types-D8f67ZCe.cjs";
2
+
3
+ //#region src/lens/internal/_lens.d.ts
4
+ interface Functor<A> {
5
+ map<B>(fn: (a: A) => B): Functor<B>;
6
+ get value(): A;
7
+ }
8
+ type Lens<Source, Focus> = (functorFactory: (focus: Focus) => Functor<Focus>) => (source: Source) => Functor<Source>;
9
+ //#endregion
10
+ //#region src/lens/idx.d.ts
11
+ declare function idx<T>(index: number): Lens<T[], Accessed<T>>;
12
+ declare namespace idx {
13
+ var or: typeof idxOr;
14
+ }
15
+ declare function idxOr<T>(index: number, defaultValue: T): Lens<T[], T>;
16
+ //#endregion
17
+ //#region src/lens/iso.d.ts
18
+ declare function iso<A, B>(to: (a: A) => B, from: (b: B) => A): Lens<A, B>;
19
+ //#endregion
20
+ //#region src/lens/lens.d.ts
21
+ declare function lens<Source, Focus>(getter: (source: Source) => Focus, setter: (focus: Focus, source: Source) => Source): Lens<Source, Focus>;
22
+ //#endregion
23
+ //#region src/lens/over.d.ts
24
+ declare function over<Source, Focus>(lens: Lens<Source, Focus>): {
25
+ (updateFn: (value: Focus) => Focus): (source: Source) => Source;
26
+ (source: Source, updateFn: (value: Focus) => Focus): Source;
27
+ };
28
+ //#endregion
29
+ //#region src/lens/internal/_path.d.ts
30
+ type ValueAtPath<Obj, Tuple extends readonly PropertyKey[]> = Tuple extends readonly [infer Key, ...unknown[]] ? Tuple extends readonly [unknown, ...infer Rest] ? Key extends keyof Obj ? Rest extends [] ? NonNullable<Obj[Key]> : Rest extends readonly PropertyKey[] ? ValueAtPath<NonNullable<Required<Obj>[Key]>, Rest> : never : never : never : never;
31
+ //#endregion
32
+ //#region src/lens/path.d.ts
33
+ /**
34
+ *
35
+ * @throws RangeError
36
+ */
37
+ declare function path(path: readonly []): never;
38
+ declare function path<Obj extends object, K1 extends keyof Required<Obj>>(path: readonly [K1]): (data: Obj) => ValueAtPath<Obj, [K1]> | null;
39
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>>(path: readonly [K1, K2]): (obj: Obj) => ValueAtPath<Obj, [K1, K2]> | null;
40
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>>(path: readonly [K1, K2, K3]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3]> | null;
41
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>>(path: readonly [K1, K2, K3, K4]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4]> | null;
42
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>>(path: readonly [K1, K2, K3, K4, K5]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5]> | null;
43
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>>(path: readonly [K1, K2, K3, K4, K5, K6]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]> | null;
44
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>>(path: readonly [K1, K2, K3, K4, K5, K6, K7]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]> | null;
45
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>, K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>>(path: readonly [K1, K2, K3, K4, K5, K6, K7, K8]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]> | null;
46
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>, K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>, K9 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>>>(path: readonly [K1, K2, K3, K4, K5, K6, K7, K8, K9]): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]> | null;
47
+ declare function path<const P extends readonly PropertyKey[]>(path: P): <S extends object>(data: S) => never extends ValueAtPath<S, P> ? ValueAtPath<S, P> | null : never;
48
+ declare function path(obj: unknown, path: readonly []): never;
49
+ declare function path<Obj, K1 extends keyof Required<Obj>>(obj: Obj, path: readonly [K1]): ValueAtPath<Obj, [K1]> | null;
50
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>>(obj: Obj, path: readonly [K1, K2]): ValueAtPath<Obj, [K1, K2]> | null;
51
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>>(obj: Obj, path: readonly [K1, K2, K3]): ValueAtPath<Obj, [K1, K2, K3]> | null;
52
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>>(obj: Obj, path: readonly [K1, K2, K3, K4]): ValueAtPath<Obj, [K1, K2, K3, K4]> | null;
53
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>>(obj: Obj, path: readonly [K1, K2, K3, K4, K5]): ValueAtPath<Obj, [K1, K2, K3, K4, K5]> | null;
54
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6]): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]> | null;
55
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6, K7]): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]> | null;
56
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>, K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6, K7, K8]): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]> | null;
57
+ declare function path<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>, K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>, K9 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>>>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6, K7, K8, K9]): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]> | null;
58
+ //#endregion
59
+ //#region src/lens/pathUnsafe.d.ts
60
+ declare function pathUnsafe<T = unknown>(path: readonly PropertyKey[]): (data: object) => T | null;
61
+ declare function pathUnsafe<T = unknown>(data: object, path: readonly PropertyKey[]): T | null;
62
+ //#endregion
63
+ //#region src/lens/pathOr.d.ts
64
+ declare function pathOr(path: readonly [], defaultValue: unknown): never;
65
+ declare function pathOr<Obj extends object, K1 extends keyof Required<Obj>>(path: readonly [K1], defaultValue: ValueAtPath<Obj, [K1]>): (data: Obj) => ValueAtPath<Obj, [K1]>;
66
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>>(path: readonly [K1, K2], defaultValue: ValueAtPath<Obj, [K1, K2]>): (obj: Obj) => ValueAtPath<Obj, [K1, K2]>;
67
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>>(path: readonly [K1, K2, K3], defaultValue: ValueAtPath<Obj, [K1, K2, K3]>): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3]>;
68
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>>(path: readonly [K1, K2, K3, K4], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4]>): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4]>;
69
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>>(path: readonly [K1, K2, K3, K4, K5], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5]>): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5]>;
70
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>>(path: readonly [K1, K2, K3, K4, K5, K6], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>;
71
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>>(path: readonly [K1, K2, K3, K4, K5, K6, K7], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>;
72
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>, K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>>(path: readonly [K1, K2, K3, K4, K5, K6, K7, K8], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>;
73
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>, K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>, K9 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>>>(path: readonly [K1, K2, K3, K4, K5, K6, K7, K8, K9], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]>): (obj: Obj) => ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]>;
74
+ declare function pathOr<const Path extends readonly PropertyKey[], Value>(pathway: Path, defaultValue: Value): <Obj extends object>(obj: Value extends ValueAtPath<Obj, Path> ? Obj : never) => ValueAtPath<Obj, Path>;
75
+ declare function pathOr(obj: unknown, path: readonly [], defaultValue: unknown): never;
76
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>>(obj: Obj, path: readonly [K1], defaultValue: ValueAtPath<Obj, [K1]>): ValueAtPath<Obj, [K1]>;
77
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>>(obj: Obj, path: readonly [K1, K2], defaultValue: ValueAtPath<Obj, [K1, K2]>): ValueAtPath<Obj, [K1, K2]>;
78
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>>(obj: Obj, path: readonly [K1, K2, K3], defaultValue: ValueAtPath<Obj, [K1, K2, K3]>): ValueAtPath<Obj, [K1, K2, K3]>;
79
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>>(obj: Obj, path: readonly [K1, K2, K3, K4], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4]>): ValueAtPath<Obj, [K1, K2, K3, K4]>;
80
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>>(obj: Obj, path: readonly [K1, K2, K3, K4, K5], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5]>): ValueAtPath<Obj, [K1, K2, K3, K4, K5]>;
81
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>;
82
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6, K7], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>;
83
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>, K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6, K7, K8], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>;
84
+ declare function pathOr<Obj, K1 extends keyof Required<Obj>, K2 extends keyof NonNullable<ValueAtPath<Obj, [K1]>>, K3 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2]>>, K4 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3]>>, K5 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4]>>, K6 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5]>>, K7 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6]>>, K8 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7]>>, K9 extends keyof NonNullable<ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8]>>>(obj: Obj, path: readonly [K1, K2, K3, K4, K5, K6, K7, K8, K9], defaultValue: ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]>): ValueAtPath<Obj, [K1, K2, K3, K4, K5, K6, K7, K8, K9]>;
85
+ //#endregion
86
+ //#region src/lens/pathOrUnsafe.d.ts
87
+ declare function pathOrUnsafe<T = unknown>(path: readonly PropertyKey[], defaultValue: T): (data: object) => T;
88
+ declare function pathOrUnsafe<T = unknown>(data: object, path: readonly PropertyKey[], defaultValue: T): T;
89
+ //#endregion
90
+ //#region src/lens/prop.d.ts
91
+ declare function prop<Obj extends Record<string, unknown>, Key extends keyof Obj>(key: string extends keyof Obj ? never : Key): Lens<Obj, Obj[Key]>;
92
+ declare function prop<Obj extends Record<string, unknown>>(key: string): Lens<Obj, Obj[string] | undefined>;
93
+ declare namespace prop {
94
+ var or: <Obj extends object, Key extends keyof Obj>(key: Key, defaultValue: NonNullable<Obj[Key]>) => Lens<Obj, NonNullable<Obj[Key]>>;
95
+ }
96
+ //#endregion
97
+ //#region src/lens/set.d.ts
98
+ declare function set<Source, Focus>(lens: Lens<Source, Focus>): (source: Source, value: Focus) => Source;
99
+ declare function set<Source, Focus>(lens: Lens<Source, Focus>, source: Source, value: Focus): Source;
100
+ //#endregion
101
+ //#region src/lens/tuple.d.ts
102
+ declare function tuple<A, B>(index: 0): Lens<[A, B], A>;
103
+ declare function tuple<A, B>(index: 1): Lens<[A, B], B>;
104
+ //#endregion
105
+ //#region src/lens/view.d.ts
106
+ declare function view<Source, Focus>(lens: Lens<Source, Focus>): (source: Source) => Focus;
107
+ //#endregion
108
+ export { idx, iso, lens, over, path, pathOr, pathOrUnsafe, pathUnsafe, prop, set, tuple, view };
109
+ //# sourceMappingURL=index.d.cts.map