@nejs/basic-extensions 2.6.0 → 2.8.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 (271) hide show
  1. package/.vscode/settings.json +5 -0
  2. package/README.md +6129 -1574
  3. package/dist/@nejs/basic-extensions.bundle.2.7.0.js +19 -0
  4. package/dist/@nejs/basic-extensions.bundle.2.7.0.js.map +7 -0
  5. package/dist/cjs/array.extensions.d.ts +39 -0
  6. package/dist/cjs/array.extensions.js +303 -0
  7. package/dist/cjs/array.extensions.js.map +1 -0
  8. package/dist/cjs/big.int.extension.d.ts +31 -0
  9. package/dist/cjs/big.int.extension.js +164 -0
  10. package/dist/cjs/big.int.extension.js.map +1 -0
  11. package/dist/cjs/{newClasses → classes}/asyncIterable.js +32 -44
  12. package/dist/cjs/classes/asyncIterable.js.map +1 -0
  13. package/dist/cjs/{newClasses → classes}/deferred.js +66 -138
  14. package/dist/cjs/classes/deferred.js.map +1 -0
  15. package/dist/cjs/{newClasses → classes}/descriptor.js +56 -90
  16. package/dist/cjs/classes/descriptor.js.map +1 -0
  17. package/dist/cjs/classes/index.d.ts +13 -0
  18. package/dist/cjs/classes/index.js +57 -0
  19. package/dist/cjs/classes/index.js.map +1 -0
  20. package/dist/cjs/classes/introspector.d.ts +20 -0
  21. package/dist/cjs/classes/introspector.js +130 -0
  22. package/dist/cjs/classes/introspector.js.map +1 -0
  23. package/dist/cjs/{newClasses → classes}/iterable.js +42 -63
  24. package/dist/cjs/classes/iterable.js.map +1 -0
  25. package/dist/cjs/classes/param.parser.d.ts +227 -0
  26. package/dist/cjs/classes/param.parser.js +242 -0
  27. package/dist/cjs/classes/param.parser.js.map +1 -0
  28. package/dist/cjs/classes/pluggable.proxy.d.ts +152 -0
  29. package/dist/cjs/classes/pluggable.proxy.js +444 -0
  30. package/dist/cjs/classes/pluggable.proxy.js.map +1 -0
  31. package/dist/cjs/{newClasses → classes}/refmap.js +18 -30
  32. package/dist/cjs/classes/refmap.js.map +1 -0
  33. package/dist/cjs/{newClasses → classes}/refset.js +28 -47
  34. package/dist/cjs/classes/refset.js.map +1 -0
  35. package/dist/cjs/classes/symkeys.d.ts +292 -0
  36. package/dist/cjs/classes/symkeys.js +424 -0
  37. package/dist/cjs/classes/symkeys.js.map +1 -0
  38. package/dist/cjs/classes/type.d.ts +56 -0
  39. package/dist/cjs/classes/type.js +405 -0
  40. package/dist/cjs/classes/type.js.map +1 -0
  41. package/dist/cjs/function.extensions.js +757 -0
  42. package/dist/cjs/function.extensions.js.map +1 -0
  43. package/dist/cjs/global.this.js +261 -0
  44. package/dist/cjs/global.this.js.map +1 -0
  45. package/dist/cjs/index.d.ts +4 -3
  46. package/dist/cjs/index.js +62 -32
  47. package/dist/cjs/index.js.map +1 -1
  48. package/dist/cjs/json.extensions.d.ts +2 -0
  49. package/dist/cjs/json.extensions.js +107 -0
  50. package/dist/cjs/json.extensions.js.map +1 -0
  51. package/dist/{mjs/mapextensions.d.ts → cjs/map.extensions.d.ts} +1 -0
  52. package/dist/cjs/map.extensions.js +142 -0
  53. package/dist/cjs/map.extensions.js.map +1 -0
  54. package/dist/cjs/number.extension.d.ts +44 -0
  55. package/dist/cjs/number.extension.js +260 -0
  56. package/dist/cjs/number.extension.js.map +1 -0
  57. package/dist/cjs/object.extensions.d.ts +62 -0
  58. package/dist/cjs/object.extensions.js +1116 -0
  59. package/dist/cjs/object.extensions.js.map +1 -0
  60. package/dist/cjs/proxy.extensions.d.ts +2 -0
  61. package/dist/cjs/proxy.extensions.js +207 -0
  62. package/dist/cjs/proxy.extensions.js.map +1 -0
  63. package/dist/cjs/reflect.extensions.js +316 -0
  64. package/dist/cjs/reflect.extensions.js.map +1 -0
  65. package/dist/cjs/regular.expression.extensions.d.ts +2 -0
  66. package/dist/cjs/regular.expression.extensions.js +423 -0
  67. package/dist/cjs/regular.expression.extensions.js.map +1 -0
  68. package/dist/cjs/set.extensions.d.ts +40 -0
  69. package/dist/cjs/{setextensions.js → set.extensions.js} +150 -2
  70. package/dist/cjs/set.extensions.js.map +1 -0
  71. package/dist/cjs/string.extensions.js +471 -0
  72. package/dist/cjs/string.extensions.js.map +1 -0
  73. package/dist/{mjs/symbolextensions.d.ts → cjs/symbol.extensions.d.ts} +1 -0
  74. package/dist/cjs/symbol.extensions.js +259 -0
  75. package/dist/cjs/symbol.extensions.js.map +1 -0
  76. package/dist/cjs/{weakrefextensions.js → weakref.extensions.js} +1 -1
  77. package/dist/cjs/weakref.extensions.js.map +1 -0
  78. package/dist/mjs/array.extensions.d.ts +39 -0
  79. package/dist/mjs/array.extensions.js +300 -0
  80. package/dist/mjs/array.extensions.js.map +1 -0
  81. package/dist/mjs/big.int.extension.d.ts +31 -0
  82. package/dist/mjs/big.int.extension.js +161 -0
  83. package/dist/mjs/big.int.extension.js.map +1 -0
  84. package/dist/mjs/classes/asyncIterable.js.map +1 -0
  85. package/dist/mjs/classes/deferred.js.map +1 -0
  86. package/dist/mjs/{newClasses → classes}/descriptor.js +7 -4
  87. package/dist/mjs/classes/descriptor.js.map +1 -0
  88. package/dist/mjs/classes/index.d.ts +13 -0
  89. package/dist/mjs/classes/index.js +40 -0
  90. package/dist/mjs/classes/index.js.map +1 -0
  91. package/dist/mjs/classes/introspector.d.ts +20 -0
  92. package/dist/mjs/classes/introspector.js +126 -0
  93. package/dist/mjs/classes/introspector.js.map +1 -0
  94. package/dist/mjs/classes/iterable.js.map +1 -0
  95. package/dist/mjs/classes/param.parser.d.ts +227 -0
  96. package/dist/mjs/classes/param.parser.js +238 -0
  97. package/dist/mjs/classes/param.parser.js.map +1 -0
  98. package/dist/mjs/classes/pluggable.proxy.d.ts +152 -0
  99. package/dist/mjs/classes/pluggable.proxy.js +438 -0
  100. package/dist/mjs/classes/pluggable.proxy.js.map +1 -0
  101. package/dist/mjs/{newClasses → classes}/refmap.js +3 -3
  102. package/dist/mjs/classes/refmap.js.map +1 -0
  103. package/dist/mjs/classes/refset.js.map +1 -0
  104. package/dist/mjs/classes/symkeys.d.ts +292 -0
  105. package/dist/mjs/classes/symkeys.js +420 -0
  106. package/dist/mjs/classes/symkeys.js.map +1 -0
  107. package/dist/mjs/classes/type.d.ts +56 -0
  108. package/dist/mjs/classes/type.js +401 -0
  109. package/dist/mjs/classes/type.js.map +1 -0
  110. package/dist/mjs/function.extensions.js +754 -0
  111. package/dist/mjs/function.extensions.js.map +1 -0
  112. package/dist/mjs/global.this.js +258 -0
  113. package/dist/mjs/global.this.js.map +1 -0
  114. package/dist/mjs/index.d.ts +4 -3
  115. package/dist/mjs/index.js +49 -19
  116. package/dist/mjs/index.js.map +1 -1
  117. package/dist/mjs/json.extensions.d.ts +2 -0
  118. package/dist/mjs/json.extensions.js +104 -0
  119. package/dist/mjs/json.extensions.js.map +1 -0
  120. package/dist/{cjs/mapextensions.d.ts → mjs/map.extensions.d.ts} +1 -0
  121. package/dist/mjs/map.extensions.js +139 -0
  122. package/dist/mjs/map.extensions.js.map +1 -0
  123. package/dist/mjs/number.extension.d.ts +44 -0
  124. package/dist/mjs/number.extension.js +257 -0
  125. package/dist/mjs/number.extension.js.map +1 -0
  126. package/dist/mjs/object.extensions.d.ts +62 -0
  127. package/dist/mjs/object.extensions.js +1112 -0
  128. package/dist/mjs/object.extensions.js.map +1 -0
  129. package/dist/mjs/proxy.extensions.d.ts +2 -0
  130. package/dist/mjs/proxy.extensions.js +204 -0
  131. package/dist/mjs/proxy.extensions.js.map +1 -0
  132. package/dist/mjs/reflect.extensions.js +313 -0
  133. package/dist/mjs/reflect.extensions.js.map +1 -0
  134. package/dist/mjs/regular.expression.extensions.d.ts +2 -0
  135. package/dist/mjs/regular.expression.extensions.js +420 -0
  136. package/dist/mjs/regular.expression.extensions.js.map +1 -0
  137. package/dist/mjs/set.extensions.d.ts +40 -0
  138. package/dist/mjs/{setextensions.js → set.extensions.js} +149 -1
  139. package/dist/mjs/set.extensions.js.map +1 -0
  140. package/dist/mjs/string.extensions.js +468 -0
  141. package/dist/mjs/string.extensions.js.map +1 -0
  142. package/dist/{cjs/symbolextensions.d.ts → mjs/symbol.extensions.d.ts} +1 -0
  143. package/dist/mjs/symbol.extensions.js +256 -0
  144. package/dist/mjs/symbol.extensions.js.map +1 -0
  145. package/dist/mjs/{weakrefextensions.js → weakref.extensions.js} +1 -1
  146. package/dist/mjs/weakref.extensions.js.map +1 -0
  147. package/docs/index.html +24045 -5805
  148. package/package.json +6 -4
  149. package/repl.bootstrap.js +21 -0
  150. package/src/array.extensions.js +322 -0
  151. package/src/big.int.extension.js +163 -0
  152. package/src/{newClasses → classes}/descriptor.js +16 -12
  153. package/src/classes/index.js +51 -0
  154. package/src/classes/introspector.js +167 -0
  155. package/src/classes/param.parser.js +253 -0
  156. package/src/classes/pluggable.proxy.js +485 -0
  157. package/src/{newClasses → classes}/refmap.js +5 -3
  158. package/src/classes/symkeys.js +464 -0
  159. package/src/classes/type.js +427 -0
  160. package/src/function.extensions.js +818 -0
  161. package/src/global.this.js +304 -0
  162. package/src/index.js +56 -23
  163. package/src/json.extensions.js +108 -0
  164. package/src/map.extensions.js +144 -0
  165. package/src/number.extension.js +273 -0
  166. package/src/object.extensions.js +1222 -0
  167. package/src/proxy.extensions.js +229 -0
  168. package/src/reflect.extensions.js +346 -0
  169. package/src/regular.expression.extensions.js +451 -0
  170. package/src/{setextensions.js → set.extensions.js} +151 -2
  171. package/src/string.extensions.js +515 -0
  172. package/src/symbol.extensions.js +268 -0
  173. package/tests/newClasses/refmap.test.js +3 -2
  174. package/tsconfig.base.json +5 -3
  175. package/tsconfig.cjs.json +2 -2
  176. package/tsconfig.esm.json +2 -2
  177. package/dist/@nejs/basic-extensions.bundle.2.5.0.js +0 -8
  178. package/dist/@nejs/basic-extensions.bundle.2.5.0.js.map +0 -7
  179. package/dist/cjs/arrayextensions.d.ts +0 -10
  180. package/dist/cjs/arrayextensions.js +0 -73
  181. package/dist/cjs/arrayextensions.js.map +0 -1
  182. package/dist/cjs/functionextensions.js +0 -202
  183. package/dist/cjs/functionextensions.js.map +0 -1
  184. package/dist/cjs/globals.js +0 -166
  185. package/dist/cjs/globals.js.map +0 -1
  186. package/dist/cjs/mapextensions.js +0 -32
  187. package/dist/cjs/mapextensions.js.map +0 -1
  188. package/dist/cjs/newClasses/asyncIterable.js.map +0 -1
  189. package/dist/cjs/newClasses/deferred.js.map +0 -1
  190. package/dist/cjs/newClasses/descriptor.js.map +0 -1
  191. package/dist/cjs/newClasses/iterable.js.map +0 -1
  192. package/dist/cjs/newClasses/refmap.js.map +0 -1
  193. package/dist/cjs/newClasses/refset.js.map +0 -1
  194. package/dist/cjs/objectextensions.d.ts +0 -11
  195. package/dist/cjs/objectextensions.js +0 -232
  196. package/dist/cjs/objectextensions.js.map +0 -1
  197. package/dist/cjs/reflectextensions.js +0 -111
  198. package/dist/cjs/reflectextensions.js.map +0 -1
  199. package/dist/cjs/setextensions.d.ts +0 -2
  200. package/dist/cjs/setextensions.js.map +0 -1
  201. package/dist/cjs/stringextensions.js +0 -158
  202. package/dist/cjs/stringextensions.js.map +0 -1
  203. package/dist/cjs/symbolextensions.js +0 -69
  204. package/dist/cjs/symbolextensions.js.map +0 -1
  205. package/dist/cjs/weakrefextensions.js.map +0 -1
  206. package/dist/mjs/arrayextensions.d.ts +0 -10
  207. package/dist/mjs/arrayextensions.js +0 -70
  208. package/dist/mjs/arrayextensions.js.map +0 -1
  209. package/dist/mjs/functionextensions.js +0 -199
  210. package/dist/mjs/functionextensions.js.map +0 -1
  211. package/dist/mjs/globals.js +0 -163
  212. package/dist/mjs/globals.js.map +0 -1
  213. package/dist/mjs/mapextensions.js +0 -29
  214. package/dist/mjs/mapextensions.js.map +0 -1
  215. package/dist/mjs/newClasses/asyncIterable.js.map +0 -1
  216. package/dist/mjs/newClasses/deferred.js.map +0 -1
  217. package/dist/mjs/newClasses/descriptor.js.map +0 -1
  218. package/dist/mjs/newClasses/iterable.js.map +0 -1
  219. package/dist/mjs/newClasses/refmap.js.map +0 -1
  220. package/dist/mjs/newClasses/refset.js.map +0 -1
  221. package/dist/mjs/objectextensions.d.ts +0 -11
  222. package/dist/mjs/objectextensions.js +0 -229
  223. package/dist/mjs/objectextensions.js.map +0 -1
  224. package/dist/mjs/reflectextensions.js +0 -108
  225. package/dist/mjs/reflectextensions.js.map +0 -1
  226. package/dist/mjs/setextensions.d.ts +0 -2
  227. package/dist/mjs/setextensions.js.map +0 -1
  228. package/dist/mjs/stringextensions.js +0 -155
  229. package/dist/mjs/stringextensions.js.map +0 -1
  230. package/dist/mjs/symbolextensions.js +0 -66
  231. package/dist/mjs/symbolextensions.js.map +0 -1
  232. package/dist/mjs/weakrefextensions.js.map +0 -1
  233. package/src/arrayextensions.js +0 -75
  234. package/src/functionextensions.js +0 -225
  235. package/src/globals.js +0 -196
  236. package/src/mapextensions.js +0 -32
  237. package/src/objectextensions.js +0 -256
  238. package/src/reflectextensions.js +0 -118
  239. package/src/stringextensions.js +0 -166
  240. package/src/symbolextensions.js +0 -69
  241. /package/dist/cjs/{newClasses → classes}/asyncIterable.d.ts +0 -0
  242. /package/dist/cjs/{newClasses → classes}/deferred.d.ts +0 -0
  243. /package/dist/cjs/{newClasses → classes}/descriptor.d.ts +0 -0
  244. /package/dist/cjs/{newClasses → classes}/iterable.d.ts +0 -0
  245. /package/dist/cjs/{newClasses → classes}/refmap.d.ts +0 -0
  246. /package/dist/cjs/{newClasses → classes}/refset.d.ts +0 -0
  247. /package/dist/cjs/{functionextensions.d.ts → function.extensions.d.ts} +0 -0
  248. /package/dist/cjs/{globals.d.ts → global.this.d.ts} +0 -0
  249. /package/dist/cjs/{reflectextensions.d.ts → reflect.extensions.d.ts} +0 -0
  250. /package/dist/cjs/{stringextensions.d.ts → string.extensions.d.ts} +0 -0
  251. /package/dist/cjs/{weakrefextensions.d.ts → weakref.extensions.d.ts} +0 -0
  252. /package/dist/mjs/{newClasses → classes}/asyncIterable.d.ts +0 -0
  253. /package/dist/mjs/{newClasses → classes}/asyncIterable.js +0 -0
  254. /package/dist/mjs/{newClasses → classes}/deferred.d.ts +0 -0
  255. /package/dist/mjs/{newClasses → classes}/deferred.js +0 -0
  256. /package/dist/mjs/{newClasses → classes}/descriptor.d.ts +0 -0
  257. /package/dist/mjs/{newClasses → classes}/iterable.d.ts +0 -0
  258. /package/dist/mjs/{newClasses → classes}/iterable.js +0 -0
  259. /package/dist/mjs/{newClasses → classes}/refmap.d.ts +0 -0
  260. /package/dist/mjs/{newClasses → classes}/refset.d.ts +0 -0
  261. /package/dist/mjs/{newClasses → classes}/refset.js +0 -0
  262. /package/dist/mjs/{functionextensions.d.ts → function.extensions.d.ts} +0 -0
  263. /package/dist/mjs/{globals.d.ts → global.this.d.ts} +0 -0
  264. /package/dist/mjs/{reflectextensions.d.ts → reflect.extensions.d.ts} +0 -0
  265. /package/dist/mjs/{stringextensions.d.ts → string.extensions.d.ts} +0 -0
  266. /package/dist/mjs/{weakrefextensions.d.ts → weakref.extensions.d.ts} +0 -0
  267. /package/src/{newClasses → classes}/asyncIterable.js +0 -0
  268. /package/src/{newClasses → classes}/deferred.js +0 -0
  269. /package/src/{newClasses → classes}/iterable.js +0 -0
  270. /package/src/{newClasses → classes}/refset.js +0 -0
  271. /package/src/{weakrefextensions.js → weakref.extensions.js} +0 -0
@@ -0,0 +1,424 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SymkeysExtension = exports.Symkeys = void 0;
4
+ const extension_1 = require("@nejs/extension");
5
+ /**
6
+ * Represents a secure container for storing and retrieving unique symbols
7
+ * associated with data. This class provides methods to add new symbols to
8
+ * the Symkeys and to retrieve data associated with a particular symbol.
9
+ *
10
+ * @example
11
+ * // Create a new Symkeys instance
12
+ * const symkeys = new Symkeys();
13
+ *
14
+ * // Add a symbol with associated data to the Symkeys
15
+ * const mySymbol = Symkeys.add('myIdentifier', { foo: 'bar' });
16
+ *
17
+ * // Retrieve the data using the symbol
18
+ * const myData = Symkeys.dataFor(mySymbol);
19
+ * console.log(myData); // Output: { foo: 'bar' }
20
+ */
21
+ class Symkeys {
22
+ /**
23
+ * Adds a new entry to the Symkeys with a unique symbol based on the provided
24
+ * name and associates it with the given data.
25
+ *
26
+ * @param named - The base name for the symbol to be created.
27
+ * @param [associatedData={}] - The data to associate with the symbol.
28
+ * @returns The unique symbol created for the entry.
29
+ *
30
+ * @example
31
+ * // Add an entry with associated data
32
+ * const symbol = Symkeys.add('myEntry', { foo: 'bar' });
33
+ * // Retrieve the associated data using the symbol
34
+ * const data = Symkeys.dataFor(symbol);
35
+ * console.log(data); // Output: { foo: 'bar' }
36
+ */
37
+ add(named, associatedData = {}) {
38
+ // Generate a unique token for the symbol
39
+ const token = Symkeys.token;
40
+ // Calculate a name (optionally with domain and separator)
41
+ const symName = this.calculateName(named);
42
+ // Create a symbol using the provided name and the unique token
43
+ const symbol = Symbol.for(`@${symName} #${token}`);
44
+ // Store the symbol and associated data in the Symkeys's internal map
45
+ this[Symkeys.kDataKey].set(symbol, associatedData);
46
+ // Return the unique symbol for external use
47
+ return symbol;
48
+ }
49
+ /**
50
+ * Retrieves the data associated with a given symbol from the Symkeys.
51
+ *
52
+ * This method allows access to the data that has been associated with a
53
+ * particular symbol in the Symkeys. It is useful for retrieving stored
54
+ * information when only the symbol is known.
55
+ *
56
+ * @param symbol - The symbol whose associated data is to be
57
+ * retrieved.
58
+ * @returns The data associated with the symbol, or undefined if
59
+ * the symbol is not found in the Symkeys.
60
+ *
61
+ * @example
62
+ * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys
63
+ * // with associated data
64
+ * const data = Symkeys.dataFor(mySymbol);
65
+ * console.log(data); // Output: The data associated with 'mySymbol'
66
+ */
67
+ data(forSymbol) {
68
+ return this[Symkeys.kDataKey].get(forSymbol);
69
+ }
70
+ /**
71
+ * Deletes the data associated with a given symbol from the Symkeys.
72
+ *
73
+ * This method allows removal of the data that has been associated with a
74
+ * particular symbol in the Symkeys. It is useful when you want to clean up
75
+ * or remove stored information associated with a symbol.
76
+ *
77
+ * @param {Symbol} forSymbol - The symbol whose associated data is to be
78
+ * deleted.
79
+ * @param {*} replaceWith - Optionally, if `replaceWith` is not `undefined`,
80
+ * a new value can be set after the original is deleted
81
+ * @returns {boolean} - Returns true if an element in the Symkeys existed and
82
+ * has been removed, or false if the element does not exist
83
+ *
84
+ * @example
85
+ * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys
86
+ * // with associated data
87
+ * const isDeleted = Symkeys.deleteData(mySymbol);
88
+ * console.log(isDeleted); // Output: true if data was deleted, false otherwise
89
+ */
90
+ deleteData(forSymbol, replaceWith = undefined) {
91
+ if (this.hasData(forSymbol)) {
92
+ const result = this[Symkeys.kDataKey].delete(forSymbol);
93
+ if (replaceWith !== undefined) {
94
+ this[Symkeys.kDataKey].set(forSymbol, replaceWith);
95
+ }
96
+ return result;
97
+ }
98
+ return false;
99
+ }
100
+ /**
101
+ * Checks if the Symkeys instance has data associated with a given symbol.
102
+ *
103
+ * This method checks if the Symkeys instance has any data associated with
104
+ * the provided symbol. It is useful when you need to verify if data exists
105
+ * for a particular symbol before attempting to retrieve or manipulate it.
106
+ *
107
+ * @param {Symbol} forSymbol - The symbol to check for associated data.
108
+ * @returns {boolean} Returns true if data exists for the symbol, false otherwise.
109
+ *
110
+ * @example
111
+ * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys
112
+ * // with associated data
113
+ * const hasData = Symkeys.hasData(mySymbol);
114
+ * console.log(hasData); // Output: true if data exists, false otherwise
115
+ */
116
+ hasData(forSymbol) {
117
+ return this[Symkeys.kDataKey].has(forSymbol);
118
+ }
119
+ /**
120
+ * Sets the data associated with a given symbol in the Symkeys.
121
+ *
122
+ * This method allows you to associate data with a particular symbol in the
123
+ * Symkeys. It is useful when you want to store information that can be
124
+ * retrieved later using the symbol.
125
+ *
126
+ * Note that setting only succeeds if the Symkey symbol has already been
127
+ * added via {@link Symkeys.add}
128
+ *
129
+ * @param {Symbol} forSymbol - The symbol with which the data is to be
130
+ * associated.
131
+ * @param {*} value - The data to be associated with the symbol.
132
+ * @returns {boolean} true if the value has been set, false if the key
133
+ * has not yet been added via {@link Symkeys.add}
134
+ *
135
+ * @example
136
+ * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys
137
+ * // and 'myData' is the data to be associated with 'mySymbol'
138
+ * Symkeys.setData(mySymbol, myData);
139
+ */
140
+ setData(forSymbol, value) {
141
+ if (this.hasData(forSymbol)) {
142
+ this[Symkeys.kDataKey].set(forSymbol, value);
143
+ return true;
144
+ }
145
+ return false;
146
+ }
147
+ /**
148
+ * Extracts the token part from a symbol created by the `add` method.
149
+ *
150
+ * This method parses the string representation of a symbol to retrieve
151
+ * the unique token that was appended to the symbol's name upon creation.
152
+ * It is useful for debugging or for operations that require knowledge of
153
+ * the token associated with a symbol.
154
+ *
155
+ * @param symbol - The symbol whose token is to be extracted.
156
+ * @returns The extracted token or undefined if the
157
+ * token cannot be extracted.
158
+ *
159
+ * @example
160
+ * // Assuming 'mySymbol' is a symbol created with the name 'myEntry'
161
+ * // and a token 'agftofxob6f'
162
+ * const token = Symkeys.tokenFor(mySymbol);
163
+ * console.log(token); // Output: 'agftofxob6f'
164
+ */
165
+ token(forSymbol) {
166
+ // Use a regular expression to match the token pattern in the symbol
167
+ // description exists on symbol but our JS output target is too old
168
+ return /^.* \#(.*?)$/.exec(forSymbol).description?.[1];
169
+ }
170
+ /**
171
+ * Retrieves the separator used in the Symkeys instance.
172
+ *
173
+ * This getter method allows access to the separator that is used to
174
+ * distinguish between different parts of a symbol in the Symkeys instance.
175
+ * It is useful when you need to know the separator for parsing symbols or
176
+ * constructing new ones.
177
+ *
178
+ * @returns {string} The separator used in the Symkeys instance.
179
+ *
180
+ * @example
181
+ * // Assuming the Symkeys instance has a separator '.'
182
+ * const separator = Symkeys.separator;
183
+ * console.log(separator); // Output: '.'
184
+ */
185
+ get separator() {
186
+ return this[kSeparator];
187
+ }
188
+ /**
189
+ * Retrieves an iterator for the symbols stored in the Symkeys.
190
+ *
191
+ * This method provides access to the symbols that have been stored in
192
+ * the Symkeys. It returns an iterator which can be used to loop over
193
+ * all the symbols. This is particularly useful for iterating through
194
+ * all stored data without knowing the individual symbols in advance.
195
+ *
196
+ * @returns An iterator that yields all the symbols
197
+ * stored in the Symkeys.
198
+ *
199
+ * @example
200
+ * // Assuming the Symkeys has symbols stored
201
+ * for (const symbol of Symkeys.symbols()) {
202
+ * console.log(symbol);
203
+ * }
204
+ */
205
+ symbols() {
206
+ // Retrieve the keys (symbols) from the Symkeys data map and return
207
+ // the iterator.
208
+ return this[Symkeys.kDataKey].keys();
209
+ }
210
+ /**
211
+ * Calculates a name by combining a provided name, domain, and separator.
212
+ *
213
+ * This method takes a provided name, domain, and separator as input and
214
+ * constructs a new name by combining these elements. If the domain or
215
+ * separator are not provided, it uses the default domain and separator
216
+ * stored in the Symkeys instance. If the provided name starts with the
217
+ * separator, it removes the leading separator from the name.
218
+ *
219
+ * If the domain ends with the separator, it removes the trailing separator
220
+ * from the domain. If the domain is empty, it sets the separator to an
221
+ * empty string.
222
+ *
223
+ * @param {string} providedName - The name to be used in the calculation.
224
+ * @param {string} [useDomain] - The domain to be used in the calculation.
225
+ * If not provided, the default domain of the Symkeys instance is used.
226
+ * @param {string} [useSeparator] - The separator to be used in the
227
+ * calculation. If not provided, the default separator of the Symkeys
228
+ * instance is used.
229
+ * @returns {string} The calculated name.
230
+ *
231
+ * @example
232
+ * // Assuming the Symkeys instance has a domain 'symkeys.internal'
233
+ * // and a separator '.'
234
+ * const name = Symkeys.calculateName('feature', 'symkeys.public', '/');
235
+ * console.log(name); // Output: 'symkeys.public/feature'
236
+ */
237
+ calculateName(providedName, useDomain, useSeparator) {
238
+ let domain = String(useDomain || this[Symkeys.kDomain]);
239
+ let separator = String(useSeparator || this[Symkeys.kSeparator]);
240
+ let postfix = (String(providedName).startsWith(separator)
241
+ ? providedName.substring(1)
242
+ : providedName);
243
+ if (domain.length) {
244
+ if (domain.endsWith(separator)) {
245
+ domain = domain.substring(0, domain.length - 1);
246
+ }
247
+ }
248
+ else {
249
+ separator = '';
250
+ }
251
+ return `${domain}${separator}${postfix}`;
252
+ }
253
+ /**
254
+ * Constructs a new instance of the Symkeys, setting up a proxy to
255
+ * intercept and manage access to properties.
256
+ *
257
+ * This constructor initializes the Symkeys with a proxy that
258
+ * overrides the default behavior for property access, checking, and
259
+ * enumeration. It allows the Symkeys to behave like a map for its
260
+ * own properties, while also maintaining the prototype chain.
261
+ *
262
+ * @param {string} domain an optional prefix string, to which the
263
+ * `separator` parameter value will be guaranteed to have in between
264
+ * the domain (if truthy) and the name of the added key.
265
+ * @param {string} separator defaults to a period. So if your domain
266
+ * is 'symkeys.internal' then calling {@link add()} with a name of
267
+ * `"feature"` will result in the full name being
268
+ * `"symkeys.internal.feature"`
269
+ *
270
+ * @example
271
+ * const Symkeys = new Symkeys();
272
+ * Symkeys[Symbol.for('myProperty')] = 'myValue';
273
+ * console.log(Symkeys[Symbol.for('myProperty')]); // 'myValue'
274
+ */
275
+ constructor(domain = '', separator = '.') {
276
+ // Create a prototype from the parent class to maintain the chain.
277
+ const prototype = Object.create(Object.getPrototypeOf(this));
278
+ // Store the original prototype for potential future use.
279
+ this[Symkeys.kPrototype] = prototype;
280
+ // Create map for this instance
281
+ this[Symkeys.kDataKey] = new Map();
282
+ // Store the domain
283
+ this[Symkeys.kDomain] = (typeof domain === 'string' && domain);
284
+ // Store the separator
285
+ this[Symkeys.kSeparator] = separator;
286
+ // Access the internal map that stores Symkeys data.
287
+ const map = this[Symkeys.kDataKey];
288
+ // Replace the instance's prototype with a proxy that manages
289
+ // property access and manipulation.
290
+ Object.setPrototypeOf(this, new Proxy(Object.create(prototype), {
291
+ // Return the stored prototype for the target.
292
+ getPrototypeOf(_) {
293
+ return prototype;
294
+ },
295
+ // Intercept property access.
296
+ get(target, property, receiver) {
297
+ // If the property exists in the Symkeys map, return its value.
298
+ if (map.has(property)) {
299
+ return map.get(property);
300
+ }
301
+ // Otherwise, perform the default behavior.
302
+ return Reflect.get(target, property, receiver);
303
+ },
304
+ // Check for property existence. Check both the Symkeys map and the target for
305
+ // the property.
306
+ has(target, property) {
307
+ return map.has(property) || Reflect.has(target, property);
308
+ },
309
+ // Retrieve all property keys. Combine keys from the Symkeys map and the target.
310
+ ownKeys(target) {
311
+ return [...Array.from(map.keys()), ...Reflect.ownKeys(target)];
312
+ },
313
+ // Intercept property assignment.
314
+ set(_, property, value, __) {
315
+ // If the property exists in the Symkeys map, set its value.
316
+ if (map.has(property)) {
317
+ map.set(property, value);
318
+ return true;
319
+ }
320
+ // If not, the operation is not allowed.
321
+ return false;
322
+ },
323
+ // Retrieve property descriptors.
324
+ getOwnPropertyDescriptor(_, property) {
325
+ // Convert the Symkeys map to an object to use with
326
+ // Object.getOwnPropertyDescriptor.
327
+ const object = [...map.entries()].reduce((a, e) => Object.assign(a, { [e[0]]: e[1] }), {});
328
+ // Retrieve the descriptor from the object.
329
+ return Object.getOwnPropertyDescriptor(object, property);
330
+ },
331
+ }));
332
+ }
333
+ /**
334
+ * Checks if a given value is a Symkey.
335
+ *
336
+ * This method checks if the provided value is a Symkey. A Symkey is a
337
+ * symbol that matches a specific pattern. The pattern is defined as a
338
+ * symbol that starts with '@', followed by any characters, a space, a '#',
339
+ * and ends with one or more word characters.
340
+ *
341
+ * @param {Symbol} value - The value to check.
342
+ * @returns {boolean} Returns true if the value is a Symkey, false otherwise.
343
+ *
344
+ * @example
345
+ * // Check if a symbol is a Symkey:
346
+ * const sym = Symbol('@nejs.prototype #rwiy2o905d');
347
+ * console.log(Symkeys.isSymkey(sym)); // Outputs: true
348
+ */
349
+ static isSymkey(value) {
350
+ if (!(typeof value === 'symbol' || value instanceof Symbol)) {
351
+ return false;
352
+ }
353
+ return !!/^@.*? #\w+$/.exec(value.description);
354
+ }
355
+ /**
356
+ * Generates a random token string.
357
+ *
358
+ * This method creates a pseudo-random token that can be used for various
359
+ * purposes within the library, such as generating unique identifiers or
360
+ * keys. The token is generated using a base 36 encoding, which includes
361
+ * numbers and lowercase letters.
362
+ *
363
+ * @returns A random token string.
364
+ *
365
+ * @example
366
+ * // Example of getting a random token:
367
+ * const token = MyClass.token;
368
+ * console.log(token); // Outputs a string like 'qg6k1zr0is'
369
+ */
370
+ static get token() {
371
+ return Math.random().toString(36).slice(2);
372
+ }
373
+ /**
374
+ * Reusable publicly static key for identifying where data is stored.
375
+ */
376
+ static get kDataKey() {
377
+ return Symbol.for('symkeys.data');
378
+ }
379
+ /**
380
+ * Reusable publicly static key for identifying where data is stored.
381
+ */
382
+ static get kPrototype() {
383
+ return Symbol.for('symkeys.prototype');
384
+ }
385
+ /**
386
+ * A static getter that returns a unique, reusable symbol for 'symkeys.domain'.
387
+ *
388
+ * This getter is used to create a unique symbol that can be used as a key
389
+ * for storing and retrieving domain-specific data in the Symkeys. The symbol
390
+ * is created using the `Symbol.for` method, which ensures that the same
391
+ * symbol is returned for a given key, in this case 'symkeys.domain'.
392
+ *
393
+ * @returns {Symbol} A unique symbol for 'symkeys.domain'.
394
+ *
395
+ * @example
396
+ * // Retrieve the 'symkeys.domain' symbol
397
+ * const domainSymbol = Symkeys.kDomain;
398
+ * console.log(domainSymbol); // Outputs: Symbol(symkeys.domain)
399
+ */
400
+ static get kDomain() {
401
+ return Symbol.for('symkeys.domain');
402
+ }
403
+ /**
404
+ * A static getter that returns a unique, reusable symbol for 'symkeys.separator'.
405
+ *
406
+ * This getter is used to create a unique symbol that can be used as a key
407
+ * for storing and retrieving separator-specific data in the Symkeys. The symbol
408
+ * is created using the `Symbol.for` method, which ensures that the same
409
+ * symbol is returned for a given key, in this case 'symkeys.separator'.
410
+ *
411
+ * @returns {Symbol} A unique symbol for 'symkeys.separator'.
412
+ *
413
+ * @example
414
+ * // Retrieve the 'symkeys.separator' symbol
415
+ * const separatorSymbol = Symkeys.kSeparator;
416
+ * console.log(separatorSymbol); // Outputs: Symbol(symkeys.separator)
417
+ */
418
+ static get kSeparator() {
419
+ return Symbol.for('symkeys.separator');
420
+ }
421
+ }
422
+ exports.Symkeys = Symkeys;
423
+ exports.SymkeysExtension = new extension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MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;IACxC,CAAC;CACF;AA3bD,0BA2bC;AAEY,QAAA,gBAAgB,GAAG,IAAI,qBAAS,CAAC,OAAO,CAAC,CAAA"}
@@ -0,0 +1,56 @@
1
+ export class Type {
2
+ static is(value: any, ofType: any): boolean;
3
+ static of(value: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
4
+ static named(value: any): any;
5
+ static class(value: any, mapped: any): any;
6
+ static isPrimitive(value: any): boolean;
7
+ static get primitives(): () => Generator<"number" | "bigint" | "string" | "symbol" | "boolean" | "undefined", void, unknown>;
8
+ static get typeOfTypes(): () => Generator<"number" | "object" | "bigint" | "function" | "string" | "symbol" | "boolean" | "undefined", void, unknown>;
9
+ static mapped: Map<string | undefined, BigIntConstructor | undefined>;
10
+ mapped: Map<string | undefined, BigIntConstructor | undefined>;
11
+ of(value: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
12
+ class(value: any): any;
13
+ isPrimitive(value: any): boolean;
14
+ serverJs: {
15
+ nodejs: {
16
+ 'v21.1.0': {
17
+ version: string;
18
+ date: Date;
19
+ classes: any;
20
+ nodeSpecificClasses: any;
21
+ functions: any;
22
+ objects: any;
23
+ properties: any;
24
+ symbols: any;
25
+ };
26
+ };
27
+ qjs: {
28
+ v: {
29
+ version: string;
30
+ classes: any;
31
+ functions: any;
32
+ objects: any;
33
+ properties: any;
34
+ symbols: any;
35
+ };
36
+ };
37
+ };
38
+ browser: {
39
+ arc: {
40
+ version: string;
41
+ userAgent: string;
42
+ types: {
43
+ classes: any;
44
+ browserClasses: any;
45
+ };
46
+ methods: {
47
+ readonly classes: any;
48
+ readonly functions: void;
49
+ readonly objects: void;
50
+ };
51
+ };
52
+ safari: {};
53
+ };
54
+ }
55
+ export const TypeExtensions: Extension;
56
+ import { Extension } from '@nejs/extension';