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