@nejs/basic-extensions 2.21.5 → 2.22.6

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 (266) hide show
  1. package/README.md +78 -4
  2. package/dist/@nejs/basic-extensions.bundle.2.22.6.js +25 -0
  3. package/dist/@nejs/basic-extensions.bundle.2.22.6.js.map +7 -0
  4. package/dist/cjs/classes/index.cjs +11129 -0
  5. package/dist/cjs/classes/index.cjs.map +7 -0
  6. package/dist/cjs/index.cjs +15191 -0
  7. package/dist/cjs/index.cjs.map +7 -0
  8. package/dist/cjs/utils/index.cjs +3954 -0
  9. package/dist/cjs/utils/index.cjs.map +7 -0
  10. package/dist/esm/basic-extensions.mjs +25 -0
  11. package/dist/esm/basic-extensions.mjs.map +7 -0
  12. package/package.json +16 -22
  13. package/repl.bootstrap.js +4 -7
  14. package/repl.history +26 -26
  15. package/src/classes/enumeration.js +466 -0
  16. package/src/classes/index.js +5 -1
  17. package/src/index.js +3 -1
  18. package/src/regular.expression.extensions.js +0 -35
  19. package/src/utils/toolkit.js +699 -516
  20. package/tests/arrayextensions.test.js +3 -3
  21. package/tests/index.test.js +3 -1
  22. package/tests/newClasses/asyncIterable.test.js +3 -3
  23. package/tests/newClasses/deferred.test.js +3 -3
  24. package/tests/newClasses/descriptor.test.js +3 -3
  25. package/tests/newClasses/iterable.test.js +3 -3
  26. package/tests/newClasses/refmap.test.js +3 -3
  27. package/tests/newClasses/refset.test.js +3 -3
  28. package/tests/objectextensions.test.js +3 -3
  29. package/tests/setextensions.test.js +3 -3
  30. package/tests/stringextensions.test.js +3 -2
  31. package/tests/utils/descriptor.utils.test.js +1 -1
  32. package/tests/utils/toolkit.test.js +429 -163
  33. package/.esdoc.json +0 -9
  34. package/.vscode/settings.json +0 -5
  35. package/bin/build +0 -27
  36. package/bin/clean +0 -14
  37. package/bin/esbuild +0 -91
  38. package/bin/fixup +0 -13
  39. package/bin/repl.basics.js +0 -584
  40. package/bin/repl.signature.js +0 -63
  41. package/bin/version +0 -100
  42. package/dist/@nejs/basic-extensions.bundle.2.21.5.js +0 -25
  43. package/dist/@nejs/basic-extensions.bundle.2.21.5.js.map +0 -7
  44. package/dist/cjs/array.extensions.d.ts +0 -39
  45. package/dist/cjs/array.extensions.js +0 -477
  46. package/dist/cjs/array.extensions.js.map +0 -1
  47. package/dist/cjs/big.int.extension.d.ts +0 -31
  48. package/dist/cjs/big.int.extension.js +0 -273
  49. package/dist/cjs/big.int.extension.js.map +0 -1
  50. package/dist/cjs/classes/asyncIterable.d.ts +0 -126
  51. package/dist/cjs/classes/asyncIterable.js +0 -209
  52. package/dist/cjs/classes/asyncIterable.js.map +0 -1
  53. package/dist/cjs/classes/deferred.d.ts +0 -146
  54. package/dist/cjs/classes/deferred.js +0 -291
  55. package/dist/cjs/classes/deferred.js.map +0 -1
  56. package/dist/cjs/classes/descriptor.d.ts +0 -334
  57. package/dist/cjs/classes/descriptor.js +0 -537
  58. package/dist/cjs/classes/descriptor.js.map +0 -1
  59. package/dist/cjs/classes/enum.d.ts +0 -50
  60. package/dist/cjs/classes/enum.js +0 -405
  61. package/dist/cjs/classes/enum.js.map +0 -1
  62. package/dist/cjs/classes/index.d.ts +0 -15
  63. package/dist/cjs/classes/index.js +0 -63
  64. package/dist/cjs/classes/index.js.map +0 -1
  65. package/dist/cjs/classes/introspector.d.ts +0 -20
  66. package/dist/cjs/classes/introspector.js +0 -130
  67. package/dist/cjs/classes/introspector.js.map +0 -1
  68. package/dist/cjs/classes/iterable.d.ts +0 -169
  69. package/dist/cjs/classes/iterable.js +0 -268
  70. package/dist/cjs/classes/iterable.js.map +0 -1
  71. package/dist/cjs/classes/param.parser.d.ts +0 -221
  72. package/dist/cjs/classes/param.parser.js +0 -242
  73. package/dist/cjs/classes/param.parser.js.map +0 -1
  74. package/dist/cjs/classes/pluggable.proxy.d.ts +0 -153
  75. package/dist/cjs/classes/pluggable.proxy.js +0 -444
  76. package/dist/cjs/classes/pluggable.proxy.js.map +0 -1
  77. package/dist/cjs/classes/property.d.ts +0 -79
  78. package/dist/cjs/classes/property.js +0 -284
  79. package/dist/cjs/classes/property.js.map +0 -1
  80. package/dist/cjs/classes/refmap.d.ts +0 -238
  81. package/dist/cjs/classes/refmap.js +0 -421
  82. package/dist/cjs/classes/refmap.js.map +0 -1
  83. package/dist/cjs/classes/refset.d.ts +0 -186
  84. package/dist/cjs/classes/refset.js +0 -370
  85. package/dist/cjs/classes/refset.js.map +0 -1
  86. package/dist/cjs/classes/symkeys.d.ts +0 -349
  87. package/dist/cjs/classes/symkeys.js +0 -510
  88. package/dist/cjs/classes/symkeys.js.map +0 -1
  89. package/dist/cjs/classes/type.d.ts +0 -56
  90. package/dist/cjs/classes/type.js +0 -405
  91. package/dist/cjs/classes/type.js.map +0 -1
  92. package/dist/cjs/function.extensions.d.ts +0 -12
  93. package/dist/cjs/function.extensions.js +0 -758
  94. package/dist/cjs/function.extensions.js.map +0 -1
  95. package/dist/cjs/global.this.d.ts +0 -2
  96. package/dist/cjs/global.this.js +0 -300
  97. package/dist/cjs/global.this.js.map +0 -1
  98. package/dist/cjs/index.d.ts +0 -31
  99. package/dist/cjs/index.js +0 -228
  100. package/dist/cjs/index.js.map +0 -1
  101. package/dist/cjs/json.extensions.d.ts +0 -2
  102. package/dist/cjs/json.extensions.js +0 -109
  103. package/dist/cjs/json.extensions.js.map +0 -1
  104. package/dist/cjs/map.extensions.d.ts +0 -3
  105. package/dist/cjs/map.extensions.js +0 -143
  106. package/dist/cjs/map.extensions.js.map +0 -1
  107. package/dist/cjs/math.extension.d.ts +0 -14
  108. package/dist/cjs/math.extension.js +0 -71
  109. package/dist/cjs/math.extension.js.map +0 -1
  110. package/dist/cjs/number.extension.d.ts +0 -44
  111. package/dist/cjs/number.extension.js +0 -278
  112. package/dist/cjs/number.extension.js.map +0 -1
  113. package/dist/cjs/object.extensions.d.ts +0 -33
  114. package/dist/cjs/object.extensions.js +0 -1091
  115. package/dist/cjs/object.extensions.js.map +0 -1
  116. package/dist/cjs/package.json +0 -3
  117. package/dist/cjs/proxy.extensions.d.ts +0 -2
  118. package/dist/cjs/proxy.extensions.js +0 -207
  119. package/dist/cjs/proxy.extensions.js.map +0 -1
  120. package/dist/cjs/reflect.extensions.d.ts +0 -14
  121. package/dist/cjs/reflect.extensions.js +0 -316
  122. package/dist/cjs/reflect.extensions.js.map +0 -1
  123. package/dist/cjs/regular.expression.extensions.d.ts +0 -2
  124. package/dist/cjs/regular.expression.extensions.js +0 -423
  125. package/dist/cjs/regular.expression.extensions.js.map +0 -1
  126. package/dist/cjs/set.extensions.d.ts +0 -40
  127. package/dist/cjs/set.extensions.js +0 -355
  128. package/dist/cjs/set.extensions.js.map +0 -1
  129. package/dist/cjs/string.extensions.d.ts +0 -23
  130. package/dist/cjs/string.extensions.js +0 -704
  131. package/dist/cjs/string.extensions.js.map +0 -1
  132. package/dist/cjs/symbol.extensions.d.ts +0 -11
  133. package/dist/cjs/symbol.extensions.js +0 -735
  134. package/dist/cjs/symbol.extensions.js.map +0 -1
  135. package/dist/cjs/utils/copy.object.d.ts +0 -408
  136. package/dist/cjs/utils/copy.object.js +0 -720
  137. package/dist/cjs/utils/copy.object.js.map +0 -1
  138. package/dist/cjs/utils/descriptor.utils.d.ts +0 -298
  139. package/dist/cjs/utils/descriptor.utils.js +0 -889
  140. package/dist/cjs/utils/descriptor.utils.js.map +0 -1
  141. package/dist/cjs/utils/index.d.ts +0 -75
  142. package/dist/cjs/utils/index.js +0 -61
  143. package/dist/cjs/utils/index.js.map +0 -1
  144. package/dist/cjs/utils/stdout.d.ts +0 -742
  145. package/dist/cjs/utils/stdout.js +0 -1042
  146. package/dist/cjs/utils/stdout.js.map +0 -1
  147. package/dist/cjs/utils/toolkit.d.ts +0 -1898
  148. package/dist/cjs/utils/toolkit.js +0 -1378
  149. package/dist/cjs/utils/toolkit.js.map +0 -1
  150. package/dist/cjs/weakref.extensions.d.ts +0 -2
  151. package/dist/cjs/weakref.extensions.js +0 -19
  152. package/dist/cjs/weakref.extensions.js.map +0 -1
  153. package/dist/mjs/array.extensions.d.ts +0 -39
  154. package/dist/mjs/array.extensions.js +0 -474
  155. package/dist/mjs/array.extensions.js.map +0 -1
  156. package/dist/mjs/big.int.extension.d.ts +0 -31
  157. package/dist/mjs/big.int.extension.js +0 -270
  158. package/dist/mjs/big.int.extension.js.map +0 -1
  159. package/dist/mjs/classes/asyncIterable.d.ts +0 -126
  160. package/dist/mjs/classes/asyncIterable.js +0 -204
  161. package/dist/mjs/classes/asyncIterable.js.map +0 -1
  162. package/dist/mjs/classes/deferred.d.ts +0 -146
  163. package/dist/mjs/classes/deferred.js +0 -287
  164. package/dist/mjs/classes/deferred.js.map +0 -1
  165. package/dist/mjs/classes/descriptor.d.ts +0 -334
  166. package/dist/mjs/classes/descriptor.js +0 -533
  167. package/dist/mjs/classes/descriptor.js.map +0 -1
  168. package/dist/mjs/classes/enum.d.ts +0 -50
  169. package/dist/mjs/classes/enum.js +0 -400
  170. package/dist/mjs/classes/enum.js.map +0 -1
  171. package/dist/mjs/classes/index.d.ts +0 -15
  172. package/dist/mjs/classes/index.js +0 -46
  173. package/dist/mjs/classes/index.js.map +0 -1
  174. package/dist/mjs/classes/introspector.d.ts +0 -20
  175. package/dist/mjs/classes/introspector.js +0 -126
  176. package/dist/mjs/classes/introspector.js.map +0 -1
  177. package/dist/mjs/classes/iterable.d.ts +0 -169
  178. package/dist/mjs/classes/iterable.js +0 -263
  179. package/dist/mjs/classes/iterable.js.map +0 -1
  180. package/dist/mjs/classes/param.parser.d.ts +0 -221
  181. package/dist/mjs/classes/param.parser.js +0 -238
  182. package/dist/mjs/classes/param.parser.js.map +0 -1
  183. package/dist/mjs/classes/pluggable.proxy.d.ts +0 -153
  184. package/dist/mjs/classes/pluggable.proxy.js +0 -438
  185. package/dist/mjs/classes/pluggable.proxy.js.map +0 -1
  186. package/dist/mjs/classes/property.d.ts +0 -79
  187. package/dist/mjs/classes/property.js +0 -280
  188. package/dist/mjs/classes/property.js.map +0 -1
  189. package/dist/mjs/classes/refmap.d.ts +0 -238
  190. package/dist/mjs/classes/refmap.js +0 -417
  191. package/dist/mjs/classes/refmap.js.map +0 -1
  192. package/dist/mjs/classes/refset.d.ts +0 -186
  193. package/dist/mjs/classes/refset.js +0 -366
  194. package/dist/mjs/classes/refset.js.map +0 -1
  195. package/dist/mjs/classes/symkeys.d.ts +0 -349
  196. package/dist/mjs/classes/symkeys.js +0 -506
  197. package/dist/mjs/classes/symkeys.js.map +0 -1
  198. package/dist/mjs/classes/type.d.ts +0 -56
  199. package/dist/mjs/classes/type.js +0 -401
  200. package/dist/mjs/classes/type.js.map +0 -1
  201. package/dist/mjs/function.extensions.d.ts +0 -12
  202. package/dist/mjs/function.extensions.js +0 -755
  203. package/dist/mjs/function.extensions.js.map +0 -1
  204. package/dist/mjs/global.this.d.ts +0 -2
  205. package/dist/mjs/global.this.js +0 -264
  206. package/dist/mjs/global.this.js.map +0 -1
  207. package/dist/mjs/index.d.ts +0 -31
  208. package/dist/mjs/index.js +0 -206
  209. package/dist/mjs/index.js.map +0 -1
  210. package/dist/mjs/json.extensions.d.ts +0 -2
  211. package/dist/mjs/json.extensions.js +0 -106
  212. package/dist/mjs/json.extensions.js.map +0 -1
  213. package/dist/mjs/map.extensions.d.ts +0 -3
  214. package/dist/mjs/map.extensions.js +0 -140
  215. package/dist/mjs/map.extensions.js.map +0 -1
  216. package/dist/mjs/math.extension.d.ts +0 -14
  217. package/dist/mjs/math.extension.js +0 -68
  218. package/dist/mjs/math.extension.js.map +0 -1
  219. package/dist/mjs/number.extension.d.ts +0 -44
  220. package/dist/mjs/number.extension.js +0 -275
  221. package/dist/mjs/number.extension.js.map +0 -1
  222. package/dist/mjs/object.extensions.d.ts +0 -33
  223. package/dist/mjs/object.extensions.js +0 -1088
  224. package/dist/mjs/object.extensions.js.map +0 -1
  225. package/dist/mjs/package.json +0 -3
  226. package/dist/mjs/proxy.extensions.d.ts +0 -2
  227. package/dist/mjs/proxy.extensions.js +0 -204
  228. package/dist/mjs/proxy.extensions.js.map +0 -1
  229. package/dist/mjs/reflect.extensions.d.ts +0 -14
  230. package/dist/mjs/reflect.extensions.js +0 -313
  231. package/dist/mjs/reflect.extensions.js.map +0 -1
  232. package/dist/mjs/regular.expression.extensions.d.ts +0 -2
  233. package/dist/mjs/regular.expression.extensions.js +0 -420
  234. package/dist/mjs/regular.expression.extensions.js.map +0 -1
  235. package/dist/mjs/set.extensions.d.ts +0 -40
  236. package/dist/mjs/set.extensions.js +0 -352
  237. package/dist/mjs/set.extensions.js.map +0 -1
  238. package/dist/mjs/string.extensions.d.ts +0 -23
  239. package/dist/mjs/string.extensions.js +0 -701
  240. package/dist/mjs/string.extensions.js.map +0 -1
  241. package/dist/mjs/symbol.extensions.d.ts +0 -11
  242. package/dist/mjs/symbol.extensions.js +0 -732
  243. package/dist/mjs/symbol.extensions.js.map +0 -1
  244. package/dist/mjs/utils/copy.object.d.ts +0 -408
  245. package/dist/mjs/utils/copy.object.js +0 -702
  246. package/dist/mjs/utils/copy.object.js.map +0 -1
  247. package/dist/mjs/utils/descriptor.utils.d.ts +0 -298
  248. package/dist/mjs/utils/descriptor.utils.js +0 -875
  249. package/dist/mjs/utils/descriptor.utils.js.map +0 -1
  250. package/dist/mjs/utils/index.d.ts +0 -75
  251. package/dist/mjs/utils/index.js +0 -45
  252. package/dist/mjs/utils/index.js.map +0 -1
  253. package/dist/mjs/utils/stdout.d.ts +0 -742
  254. package/dist/mjs/utils/stdout.js +0 -1037
  255. package/dist/mjs/utils/stdout.js.map +0 -1
  256. package/dist/mjs/utils/toolkit.d.ts +0 -1898
  257. package/dist/mjs/utils/toolkit.js +0 -1373
  258. package/dist/mjs/utils/toolkit.js.map +0 -1
  259. package/dist/mjs/weakref.extensions.d.ts +0 -2
  260. package/dist/mjs/weakref.extensions.js +0 -16
  261. package/dist/mjs/weakref.extensions.js.map +0 -1
  262. package/jsdoc-config.json +0 -31
  263. package/tsconfig.base.json +0 -28
  264. package/tsconfig.cjs.json +0 -8
  265. package/tsconfig.esm.json +0 -8
  266. package/vitest.config.js +0 -7
@@ -1,273 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BigIntPrototypeExtensions = exports.BigIntExtensions = void 0;
4
- const extension_1 = require("@nejs/extension");
5
- /**
6
- * `BigIntExtensions` is a patch for the JavaScript built-in `BigInt` class.
7
- * It adds utility methods to the `BigInt` class without modifying the global
8
- * namespace directly. This patch includes methods for checking if a value is
9
- * a `BigInt` and conditionally returning a value based on whether the supplied
10
- * value is a `BigInt` or not.
11
- *
12
- * @type {Patch}
13
- * @example
14
- * import { BigIntExtensions } from 'big.int.extension.js'
15
- *
16
- * BigIntExtensions.apply()
17
- * // Now the `BigInt` class has additional methods available
18
- */
19
- exports.BigIntExtensions = new extension_1.Patch(BigInt, {
20
- [extension_1.Patch.kMutablyHidden]: {
21
- /**
22
- * Checks if all or some of the supplied values are numbers.
23
- *
24
- * This method uses the `Array.prototype.every` or `Array.prototype.some`
25
- * method to check if all or some of the supplied values are numbers,
26
- * respectively. The method to use is determined by the `which` parameter.
27
- *
28
- * @param {string} [which='every'] - Determines the method to use for the
29
- * check. Can be either 'every' or 'some'. Defaults to 'every'.
30
- * @param {...*} values - The values to check.
31
- * @returns {boolean} - Returns `true` if all or some of the values are
32
- * numbers (based on the `which` parameter), `false` otherwise.
33
- *
34
- * @example
35
- * areNumbers('every', 1, 2, 3) // true
36
- * areNumbers('some', 1, '2', 3) // true
37
- * areNumbers('every', 1, '2', 3) // false
38
- */
39
- areBigInts(which = ['every', 'some'][0], ...values) {
40
- if (which !== 'every' && which !== 'some') {
41
- return false;
42
- }
43
- return values[which](num => this.isBigInt(num));
44
- },
45
- /**
46
- * Determines if the supplied `value` is a `BigInt`. This check is
47
- * performed by first checking the `typeof` the `value` and then
48
- * checking to see if the `value` is an `instanceof` `BigInt`
49
- *
50
- * @param {*} value The value that needs to be checked to determine
51
- * if it is a `BigInt` or not
52
- * @returns {boolean} `true` if the supplied `value` is a `BigInt`,
53
- * `false` otherwise
54
- *
55
- * @example
56
- * const bigInt = 1234567890123456789012345678901234567890n
57
- * isBigInt(bigInt) // true
58
- * isBigInt(1234567890123456789012345678901234567890) // false
59
- * isBigInt('1234567890123456789012345678901234567890') // false
60
- * isBigInt(BigInt('1234567890123456789012345678901234567890')) // true
61
- */
62
- isBigInt(value) {
63
- return typeof value === 'bigint' || value instanceof BigInt;
64
- },
65
- /**
66
- * Conditionally returns a value based on whether the supplied
67
- * `value` is a `BigInt` or not. If the `value` is a `BigInt`,
68
- * the `thenValue` will be returned. If it is not a `BigInt`,
69
- * the `elseValue` will be returned instead.
70
- *
71
- * @param {any} value The value to check to determine if it is a
72
- * `BigInt`
73
- * @param {any} thenValue The value to return if the supplied
74
- * `value` is a `BigInt`
75
- * @param {any} elseValue The value to return if the supplied
76
- * `value` is not a `BigInt`
77
- * @returns {any} Either the `thenValue` or `elseValue` depending
78
- * on if the supplied `value` is a `BigInt`
79
- *
80
- * @example
81
- * const bigInt = 1234567890123456789012345678901234567890n
82
- * const num = 42
83
- * ifBigInt(bigInt, 'is a BigInt', 'not a BigInt')
84
- * // 'is a BigInt'
85
- * ifBigInt(num, 'is a BigInt', 'not a BigInt')
86
- * // 'not a BigInt'
87
- */
88
- ifBigInt(value, thenValue, elseValue) {
89
- return isThenElse(this.isBigInt(value), thenValue, elseValue);
90
- },
91
- /**
92
- * The Math.min() static method returns the smallest of the numbers given
93
- * as input parameters, or Infinity if there are no parameters.
94
- *
95
- * @param {bigint|number} values value1, …, valueN – Zero or more numbers
96
- * among which the lowest value will be selected and returned.
97
- * @returns {bigint|number|Infinity} The smallest of the given numbers.
98
- * Returns Infinity if no parameters are provided.
99
- */
100
- min(...values) {
101
- const sorter = (l, r) => l < r ? -1 : l > r ? 1 : 0;
102
- if (!values.length)
103
- return Infinity;
104
- if (values.every(n => typeof n === 'bigint')) {
105
- return values.toSorted(sorter).at(0);
106
- }
107
- else {
108
- throw new TypeError('All supplied values must be of type bigint');
109
- }
110
- },
111
- /**
112
- * The Math.max() static method returns the largest of the numbers given
113
- * as input parameters, or Infinity if there are no parameters.
114
- *
115
- * @param {bigint|number} values value1, …, valueN – Zero or more numbers
116
- * among which the largest value will be selected and returned.
117
- * @returns {bigint|number|Infinity} The largest of the given numbers.
118
- * Returns Infinity if no parameters are provided.
119
- */
120
- max(...values) {
121
- const sorter = (l, r) => l < r ? -1 : l > r ? 1 : 0;
122
- if (!values.length)
123
- return Infinity;
124
- if (values.every(n => typeof n === 'bigint')) {
125
- return values.toSorted(sorter).at(-1);
126
- }
127
- else {
128
- throw new TypeError('All supplied values must be of type bigint');
129
- }
130
- },
131
- },
132
- });
133
- const { isBigInt: pIsBigInt, ifBigInt: pIfBigInt } = exports.BigIntExtensions.patches;
134
- /**
135
- * `BigIntPrototypeExtensions` is a patch for the JavaScript built-in
136
- * `BigInt.prototype`. It adds utility methods to the `BigInt` prototype
137
- * without modifying the global namespace directly. This patch includes
138
- * methods for checking if a value is a BigInt and conditionally returning
139
- * a value based on whether the supplied value is a BigInt or not.
140
- *
141
- * @type {Patch}
142
- * @example
143
- * import { BigIntPrototypeExtensions } from 'big.int.extension.js'
144
- *
145
- * BigIntPrototypeExtensions.apply()
146
- * // Now the `BigInt` prototype has additional methods available
147
- */
148
- exports.BigIntPrototypeExtensions = new extension_1.Patch(BigInt.prototype, {
149
- /**
150
- * Clamps a value between a minimum and maximum value.
151
- *
152
- * This method checks if the provided value and the min and max bounds are
153
- * numbers. If they are not, it returns the original value. If they are,
154
- * it ensures that the value does not go below the minimum value or above
155
- * the maximum value.
156
- *
157
- * @param {bigint} [minValue=BigInt(-Number.MAX_VALUE)] - The minimum value.
158
- * Defaults to BigInt(-Number.MAX_VALUE).
159
- * @param {bigint} [maxValue=BigInt(Number.MAX_VALUE)] - The maximum value.
160
- * Defaults to BigInt(Number.MAX_VALUE).
161
- * @returns {bigint} - Returns the clamped value if all parameters are
162
- * big integers.
163
- *
164
- * @example
165
- * (10n).clamp(1n, 5n) // returns 5n
166
- * (-10n).clamp(1n, 5n) // returns 1n
167
- * (3n).clamp(1n, 5n) // returns 3n
168
- */
169
- clamp(minValue = BigInt(-Number.MAX_VALUE), maxValue = BigInt(Number.MAX_VALUE)) {
170
- if (typeof minValue !== 'bigint' || typeof maxValue !== 'bigint')
171
- throw new TypeError('All values must be big integers');
172
- return BigInt.max(minValue, BigInt.min(maxValue, this));
173
- },
174
- /**
175
- * A getter method that returns an object representation of the BigInt
176
- * instance.
177
- *
178
- * This method wraps the BigInt instance in an object, allowing it to be
179
- * treated as an object. The returned object is created using the `Object()`
180
- * constructor, which takes the BigInt instance as its argument.
181
- *
182
- * @type {Object}
183
- * @readonly
184
- *
185
- * @example
186
- * const bigInt = 1234567890123456789012345678901234567890n
187
- * console.log(typeof bigInt) // 'bigint'
188
- * console.log(typeof bigInt.instance) // 'object'
189
- */
190
- get instance() {
191
- return Object(this);
192
- },
193
- /**
194
- * A getter method that checks if the current instance is a BigInt.
195
- *
196
- * This method uses the `pIsBigInt` function from the `BigIntExtensions`
197
- * patch to determine if the current instance (`this`) is a BigInt.
198
- *
199
- * @type {boolean}
200
- * @readonly
201
- *
202
- * @example
203
- * const bigInt = 1234567890123456789012345678901234567890n
204
- * console.log(bigInt.isBigInt) // Output: true
205
- *
206
- * const notBigInt = 42
207
- * console.log(notBigInt.isBigInt) // Output: false
208
- */
209
- get isBigInt() {
210
- return pIsBigInt(this);
211
- },
212
- /**
213
- * Checks if the current object is a BigInt and returns the corresponding
214
- * value based on the result.
215
- *
216
- * This method uses the `pIfBigInt` function from the `BigIntExtensions`
217
- * patch to determine if the current object (`this`) is a BigInt. If it is
218
- * a BigInt, the `thenValue` is returned. Otherwise, the `elseValue` is
219
- * returned.
220
- *
221
- * @param {any} thenValue - The value to return if the current object
222
- * is a BigInt.
223
- * @param {any} elseValue - The value to return if the current object
224
- * is not a BigInt.
225
- * @returns {any} The `thenValue` if the current object is a BigInt, or
226
- * the `elseValue` if it is not a BigInt.
227
- *
228
- * @example
229
- * const bigInt = 1234567890123456789012345678901234567890n
230
- * // 'Is a BigInt'
231
- * console.log(bigInt.ifBigInt('Is a BigInt', 'Not a BigInt'))
232
- *
233
- * const notBigInt = 42
234
- * // 'Not a BigInt'
235
- * console.log(notBigInt.ifBigInt('Is a BigInt', 'Not a BigInt'))
236
- */
237
- ifBigInt(thenValue, elseValue) {
238
- return pIfBigInt(this, thenValue, elseValue);
239
- },
240
- /**
241
- * Provides a way when dealing with numbers to determine if
242
- * a given number is within a range of values. By default, if
243
- * no parameters are supplied, it always returns true since
244
- * the default range is -Infinity to +Infinity. Additionally,
245
- * by default, the number will always be less than the supplied
246
- * max unless inclusive is set to true.
247
- *
248
- * @param min the lower range value, defaults to -Infinity
249
- * @param max the upper range value, defaults to +Infinity
250
- * @param inclusive defaults to false, set to true if you
251
- * want the max value to less than and equals to
252
- * @returns {boolean} true if within the range, false otherwise
253
- */
254
- within(min = BigInt(-Infinity), max = BigInt(Infinity), inclusive = false) {
255
- return this >= min && (inclusive ? this <= max : this < max);
256
- }
257
- });
258
- // NOTE to self; this is repeated here otherwise a circular reference from
259
- // Object<->Function<->Global occurs. See original source in global.this.js
260
- // {@see globalThis.isThenElse}
261
- function isThenElse(bv, tv, ev) {
262
- function isFunction(value) { typeof value === 'function'; }
263
- if (arguments.length > 1) {
264
- var _then = isFunction(tv) ? tv(bv) : tv;
265
- if (arguments.length > 2) {
266
- var _else = isFunction(ev) ? tv(bv) : ev;
267
- return bv ? _then : _else;
268
- }
269
- return bv || _then;
270
- }
271
- return bv;
272
- }
273
- //# sourceMappingURL=big.int.extension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"big.int.extension.js","sourceRoot":"","sources":["../../src/big.int.extension.js"],"names":[],"mappings":";;;AAAA,+CAAuC;AAEvC;;;;;;;;;;;;;GAaG;AACU,QAAA,gBAAgB,GAAG,IAAI,iBAAK,CAAC,MAAM,EAAE;IAChD,CAAC,iBAAK,CAAC,cAAc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,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;QACrE,CAAC;QAAC,OAAO,EAAE,IAAI,KAAK,CAAC;IACvB,CAAC;IAAC,OAAO,EAAE,CAAA;AACb,CAAC"}
@@ -1,126 +0,0 @@
1
- /**
2
- * The AsyncIterable class extends the concept of Iterable to asynchronous
3
- * operations. It allows creating iterable objects where each element can be
4
- * an asynchronous entity, like a Promise. This class is particularly useful
5
- * when dealing with asynchronous data sources, such as API responses, file
6
- * reading in chunks, or any other data that is not immediately available but
7
- * arrives over time.
8
- */
9
- export class AsyncIterable {
10
- /**
11
- * Checks if a given value is an async iterable. This method determines if
12
- * the provided value has a `Symbol.asyncIterator` property that is an async
13
- * generator function. It's a precise way to identify if the value conforms
14
- * to the async iterable protocol using an async generator function.
15
- *
16
- * Note: This method specifically checks for async generator functions. Some
17
- * async iterables might use regular async functions that return an async
18
- * iterator, which this method won't identify.
19
- *
20
- * @param {*} value - The value to be checked for async iterability.
21
- * @returns {boolean} - Returns true if the value is an async iterable
22
- * implemented using an async generator function, false otherwise.
23
- */
24
- static isAsyncIterable(value: any): boolean;
25
- /**
26
- * Constructs an instance of AsyncIterable. Similar to Iterable, it can be
27
- * initialized with either an iterable object, an async generator function,
28
- * or individual elements. The elements can be promises, direct values, or a
29
- * mix of both. If the first argument is an iterable or an async generator
30
- * function, the instance is initialized with the elements from the iterable
31
- * or the generated elements from the async generator function, followed by
32
- * any additional arguments. If the first argument is not an iterable or an
33
- * async generator function, all arguments are treated as individual elements.
34
- *
35
- * @param {Iterable|AsyncGeneratorFunction|Promise|*} elementsOrFirstElement -
36
- * An iterable object, an async generator function, a Promise, or the first
37
- * element.
38
- * @param {...Promise|*} moreElements - Additional elements if the first
39
- * argument is not an iterable or an async generator function.
40
- */
41
- constructor(elementsOrFirstElement: Iterable<any> | AsyncGeneratorFunction | Promise<any> | any, ...moreElements: (Promise<any> | any)[]);
42
- /**
43
- * Implements the async iterable protocol. When an instance of AsyncIterable
44
- * is used in a `for await...of` loop, this async generator function is
45
- * invoked. It yields each element as a Promise, allowing asynchronous
46
- * iteration. Elements that are not Promises are automatically wrapped in
47
- * a resolved Promise to ensure consistency.
48
- *
49
- * @returns {AsyncGenerator} An async generator that yields each element as
50
- * a Promise.
51
- */
52
- [Symbol.asyncIterator](): AsyncGenerator;
53
- /**
54
- * Ensures that the constructor of this object instance's name
55
- * is returned if the string tag for this instance is queried
56
- *
57
- * @returns {string} the name of the class
58
- */
59
- get [Symbol.toStringTag](): string;
60
- #private;
61
- }
62
- /**
63
- * Being able to create a compliant `AsyncIterator` around any type of
64
- * iterable object. This can be wrapped around any type of object that
65
- * has a `[Symbol.asyncIterator]` property assigned to a generator
66
- * function.
67
- */
68
- export class AsyncIterator {
69
- /**
70
- * Creates a new `AsyncIterator` object instance.
71
- *
72
- * @param {object|AsyncGeneratorFunction} asyncIterable any object that has a
73
- * `[Symbol.asyncIterable]` property assigned to a generator function or an
74
- * async generator function itself.
75
- */
76
- constructor(asyncIterable: object | AsyncGeneratorFunction);
77
- /**
78
- * Returns a new `Array` derived from the iterable this object
79
- * wraps.
80
- *
81
- * @returns {array} a new `Array` generated from the wrapped
82
- * iterable. The method is generated from using an async for of
83
- * loop.
84
- */
85
- asArray(): any[];
86
- /**
87
- * Returns the actual iterable object passed to the constructor that
88
- * created this instance.
89
- *
90
- * @returns {object} the object containing the `[Symbol.iterator]`
91
- */
92
- get asyncIterable(): object;
93
- /**
94
- * The function retrieves the next value in the iterator. If the
95
- * the iterator has run its course, `reset()` can be invoked to
96
- * reset the pointer to the beginning of the iteration.
97
- *
98
- * @returns {any} the next value
99
- */
100
- next(): any;
101
- /**
102
- * Resets the async iterator to the beginning allowing it to be
103
- * iterated over again.
104
- */
105
- reset(): Promise<void>;
106
- /**
107
- * The existence of this symbol on the object instances, indicates that
108
- * it can be used in `for(.. of ..)` loops and its values can be
109
- * extracted from calls to `Array.from()`
110
- *
111
- * @returns {AsyncIterable} this is returned since this object is already
112
- * conforming to the expected JavaScript AsyncIterator interface
113
- */
114
- [Symbol.asyncIterator](): AsyncIterable;
115
- /**
116
- * Ensures that the constructor of this object instance's name
117
- * is returned if the string tag for this instance is queried
118
- *
119
- * @returns {string} the name of the class
120
- */
121
- get [Symbol.toStringTag](): string;
122
- #private;
123
- }
124
- export const AsyncIterableExtensions: Extension;
125
- export const AsyncIteratorExtensions: Extension;
126
- import { Extension } from '@nejs/extension';
@@ -1,209 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AsyncIteratorExtensions = exports.AsyncIterableExtensions = exports.AsyncIterator = exports.AsyncIterable = void 0;
4
- const extension_1 = require("@nejs/extension");
5
- /**
6
- * The AsyncIterable class extends the concept of Iterable to asynchronous
7
- * operations. It allows creating iterable objects where each element can be
8
- * an asynchronous entity, like a Promise. This class is particularly useful
9
- * when dealing with asynchronous data sources, such as API responses, file
10
- * reading in chunks, or any other data that is not immediately available but
11
- * arrives over time.
12
- */
13
- class AsyncIterable {
14
- /**
15
- * Private field to store the elements of the async iterable.
16
- * @private
17
- */
18
- #elements = [];
19
- /**
20
- * Constructs an instance of AsyncIterable. Similar to Iterable, it can be
21
- * initialized with either an iterable object, an async generator function,
22
- * or individual elements. The elements can be promises, direct values, or a
23
- * mix of both. If the first argument is an iterable or an async generator
24
- * function, the instance is initialized with the elements from the iterable
25
- * or the generated elements from the async generator function, followed by
26
- * any additional arguments. If the first argument is not an iterable or an
27
- * async generator function, all arguments are treated as individual elements.
28
- *
29
- * @param {Iterable|AsyncGeneratorFunction|Promise|*} elementsOrFirstElement -
30
- * An iterable object, an async generator function, a Promise, or the first
31
- * element.
32
- * @param {...Promise|*} moreElements - Additional elements if the first
33
- * argument is not an iterable or an async generator function.
34
- */
35
- constructor(elementsOrFirstElement, ...moreElements) {
36
- if (elementsOrFirstElement != null &&
37
- (typeof elementsOrFirstElement[Symbol.iterator] === 'function' ||
38
- typeof elementsOrFirstElement[Symbol.asyncIterator] === 'function')) {
39
- this.#elements = [...elementsOrFirstElement, ...moreElements];
40
- }
41
- else if (typeof elementsOrFirstElement === 'function' &&
42
- elementsOrFirstElement.constructor.name === 'AsyncGeneratorFunction') {
43
- this.#elements = elementsOrFirstElement();
44
- }
45
- else {
46
- this.#elements = [elementsOrFirstElement, ...moreElements];
47
- }
48
- }
49
- /**
50
- * Implements the async iterable protocol. When an instance of AsyncIterable
51
- * is used in a `for await...of` loop, this async generator function is
52
- * invoked. It yields each element as a Promise, allowing asynchronous
53
- * iteration. Elements that are not Promises are automatically wrapped in
54
- * a resolved Promise to ensure consistency.
55
- *
56
- * @returns {AsyncGenerator} An async generator that yields each element as
57
- * a Promise.
58
- */
59
- async *[Symbol.asyncIterator]() {
60
- for await (const element of this.#elements) {
61
- // No need to wrap as a promise here since `for await...of` can handle
62
- // both Promises and non-Promise values.
63
- yield element;
64
- }
65
- }
66
- /**
67
- * Ensures that the constructor of this object instance's name
68
- * is returned if the string tag for this instance is queried
69
- *
70
- * @returns {string} the name of the class
71
- */
72
- get [Symbol.toStringTag]() {
73
- return this.constructor.name;
74
- }
75
- /**
76
- * Checks if a given value is an async iterable. This method determines if
77
- * the provided value has a `Symbol.asyncIterator` property that is an async
78
- * generator function. It's a precise way to identify if the value conforms
79
- * to the async iterable protocol using an async generator function.
80
- *
81
- * Note: This method specifically checks for async generator functions. Some
82
- * async iterables might use regular async functions that return an async
83
- * iterator, which this method won't identify.
84
- *
85
- * @param {*} value - The value to be checked for async iterability.
86
- * @returns {boolean} - Returns true if the value is an async iterable
87
- * implemented using an async generator function, false otherwise.
88
- */
89
- static isAsyncIterable(value) {
90
- const type = Object.prototype.toString.call(value?.[Symbol.asyncIterator]);
91
- return type === '[object AsyncGeneratorFunction]';
92
- }
93
- }
94
- exports.AsyncIterable = AsyncIterable;
95
- /**
96
- * Being able to create a compliant `AsyncIterator` around any type of
97
- * iterable object. This can be wrapped around any type of object that
98
- * has a `[Symbol.asyncIterator]` property assigned to a generator
99
- * function.
100
- */
101
- class AsyncIterator {
102
- /**
103
- * Creates a new `AsyncIterator` object instance.
104
- *
105
- * @param {object|AsyncGeneratorFunction} asyncIterable any object that has a
106
- * `[Symbol.asyncIterable]` property assigned to a generator function or an
107
- * async generator function itself.
108
- */
109
- constructor(asyncIterable) {
110
- if (typeof asyncIterable === 'function' &&
111
- asyncIterable.constructor.name === 'AsyncGeneratorFunction') {
112
- this.#asyncIterable = asyncIterable();
113
- }
114
- else if (!asyncIterable ||
115
- !Reflect.has(asyncIterable, Symbol.asyncIterator)) {
116
- throw new TypeError('Value used to instantiate AsyncIterator is not an async iterable');
117
- }
118
- else {
119
- this.#asyncIterable = asyncIterable;
120
- }
121
- this.#asyncIterator = this.#asyncIterable[Symbol.asyncIterator]();
122
- }
123
- /**
124
- * Returns a new `Array` derived from the iterable this object
125
- * wraps.
126
- *
127
- * @returns {array} a new `Array` generated from the wrapped
128
- * iterable. The method is generated from using an async for of
129
- * loop.
130
- */
131
- async asArray() {
132
- const array = [];
133
- for await (const value of this) {
134
- array.push(value);
135
- }
136
- return array;
137
- }
138
- /**
139
- * Returns the actual iterable object passed to the constructor that
140
- * created this instance.
141
- *
142
- * @returns {object} the object containing the `[Symbol.iterator]`
143
- */
144
- get asyncIterable() {
145
- return this.#asyncIterable;
146
- }
147
- /**
148
- * The function retrieves the next value in the iterator. If the
149
- * the iterator has run its course, `reset()` can be invoked to
150
- * reset the pointer to the beginning of the iteration.
151
- *
152
- * @returns {any} the next value
153
- */
154
- async next() {
155
- const result = await this.#asyncIterator.next();
156
- if (result.done) {
157
- return { value: undefined, done: true };
158
- }
159
- else {
160
- return { value: result.value, done: false };
161
- }
162
- }
163
- /**
164
- * Resets the async iterator to the beginning allowing it to be
165
- * iterated over again.
166
- */
167
- async reset() {
168
- this.#asyncIterator = this.#asyncIterable[Symbol.asyncIterator]();
169
- }
170
- /**
171
- * The existence of this symbol on the object instances, indicates that
172
- * it can be used in `for(.. of ..)` loops and its values can be
173
- * extracted from calls to `Array.from()`
174
- *
175
- * @returns {AsyncIterable} this is returned since this object is already
176
- * conforming to the expected JavaScript AsyncIterator interface
177
- */
178
- [Symbol.asyncIterator]() {
179
- return this;
180
- }
181
- /**
182
- * Ensures that the constructor of this object instance's name
183
- * is returned if the string tag for this instance is queried
184
- *
185
- * @returns {string} the name of the class
186
- */
187
- get [Symbol.toStringTag]() {
188
- return this.constructor.name;
189
- }
190
- /**
191
- * The object from which its iterator functionality is derived.
192
- *
193
- * @type {object}
194
- * @private
195
- */
196
- #asyncIterable = null;
197
- /**
198
- * The results of a call to the iterable's `[Symbol.asyncIterator]`
199
- * generator function.
200
- *
201
- * @type {object}
202
- * @private
203
- */
204
- #asyncIterator = null;
205
- }
206
- exports.AsyncIterator = AsyncIterator;
207
- exports.AsyncIterableExtensions = new extension_1.Extension(AsyncIterable);
208
- exports.AsyncIteratorExtensions = new extension_1.Extension(AsyncIterator);
209
- //# sourceMappingURL=asyncIterable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asyncIterable.js","sourceRoot":"","sources":["../../../src/classes/asyncIterable.js"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C;;;;;;;GAOG;AACH,MAAa,aAAa;IACxB;;;OAGG;IACH,SAAS,GAAG,EAAE,CAAC;IAEf;;;;;;;;;;;;;;;OAeG;IACH,YAAY,sBAAsB,EAAE,GAAG,YAAY;QACjD,IACE,sBAAsB,IAAI,IAAI;YAC9B,CAAC,OAAO,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU;gBAC7D,OAAO,sBAAsB,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,UAAU,CAAC,EACpE,CAAC;YACD,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,sBAAsB,EAAE,GAAG,YAAY,CAAC,CAAC;QAChE,CAAC;aAAM,IACL,OAAO,sBAAsB,KAAK,UAAU;YAC5C,sBAAsB,CA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