@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,506 +0,0 @@
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 symbol to the Symkeys instance with the given name and
21
- * associated data.
22
- *
23
- * This method generates a unique symbol based on the provided name,
24
- * optional domain, separator, and token. It also allows embedding
25
- * additional data into the symbol's name.
26
- *
27
- * @param {string} named - The base name for the new symbol.
28
- * @param {Object} options - Additional options for the symbol.
29
- * @param {*} [options.associate={}] - Data to associate with the symbol.
30
- * @param {Object} [options.embed] - Optional data to embed in the symbol.
31
- * @param {string} [options.useDomain] - Optional domain to include in the
32
- * symbol's name.
33
- * @param {string} [options.useSeparator] - Optional separator to use in
34
- * the symbol's name.
35
- * @param {string} [options.useToken] - Optional token to use for the
36
- * symbol. If not provided, a random token is generated.
37
- * @returns {Symbol} The newly created symbol.
38
- *
39
- * @example
40
- * // Add a symbol with associated data
41
- * const mySymbol = symkeys.add('myIdentifier', {
42
- * associate: { foo: 'bar' },
43
- * embed: { baz: 'qux' },
44
- * useDomain: 'exampleDomain',
45
- * useSeparator: '-',
46
- * useToken: 'customToken',
47
- * })
48
- * console.log(mySymbol)
49
- * // Symbol(@exampleDomain-myIdentifier {"baz":"qux"} #customToken)
50
- */
51
- add(named, { associate = {}, embed = undefined, useDomain = undefined, useSeparator = undefined, useToken = undefined, }) {
52
- // Generate a unique token for the symbol
53
- const token = useToken ?? Symkeys.token;
54
- // Calculate a name (optionally with domain and separator)
55
- let symName = this.calculateName(named, useDomain, useSeparator);
56
- if (embed && typeof embed === 'object') {
57
- try {
58
- symName += ` ${JSON.stringify(embed)}`;
59
- }
60
- catch (error) {
61
- console.warn(`Cannot create JSON from ${embed}; skipping`);
62
- }
63
- }
64
- // Create a symbol using the provided name and the unique token
65
- const symbol = Symbol.for(`@${symName} #${token}`);
66
- // Store the symbol and associated data in the Symkeys's internal map
67
- this[Symkeys.kDataKey].set(symbol, associate ?? {});
68
- // Return the unique symbol for external use
69
- return symbol;
70
- }
71
- /**
72
- * Creates or retrieves a shared symbol key with the given name and
73
- * optional associated data.
74
- *
75
- * This method generates a shared symbol key using the provided name
76
- * and optional parameters. If the symbol already exists in the
77
- * Symkeys's internal map, it updates the associated data if provided.
78
- * Otherwise, it creates a new symbol with the specified parameters.
79
- *
80
- * @param {string} named - The name to use for the shared symbol key.
81
- * @param {Object} options - Optional parameters for the shared symbol key.
82
- * @param {Object} [options.associate] - Data to associate with the symbol.
83
- * @param {Object} [options.embed] - Data to embed in the symbol's name.
84
- * @param {string} [options.useDomain] - Domain to include in the symbol's name.
85
- * @param {string} [options.useSeparator] - Separator to use in the symbol's name.
86
- * @returns {Symbol} The shared symbol key.
87
- *
88
- * @example
89
- * // Create or retrieve a shared symbol key with associated data
90
- * const sharedSymbol = symkeys.sharedKey('mySharedKey', {
91
- * associate: { foo: 'bar' },
92
- * embed: { baz: 'qux' },
93
- * useDomain: 'exampleDomain',
94
- * useSeparator: '-',
95
- * })
96
- * console.log(sharedSymbol)
97
- * // Symbol(@exampleDomain-mySharedKey {"baz":"qux"} #shared)
98
- */
99
- sharedKey(named, { associate, embed, useDomain, useSeparator }) {
100
- // Calculate the symbol name with optional domain and separator
101
- const symName = this.calculateName(named, useDomain, useSeparator);
102
- // Initialize JSON string for embedded data
103
- let json = '';
104
- if (embed && typeof embed === 'object') {
105
- try {
106
- json = ` ${JSON.stringify(embed)}`;
107
- }
108
- catch (ignored) {
109
- // Ignore JSON stringify errors
110
- }
111
- }
112
- // Create the shared symbol key
113
- const symbol = Symbol.for(`@${symName}${json} #shared`);
114
- // Check if the symbol already exists in the internal map
115
- if (this[Symkeys.kDataKey].has(symbol)) {
116
- // Update associated data if provided and symbol is a Symkey
117
- if (associate && symbol.isSymkey) {
118
- symbol.data = associate;
119
- }
120
- // Return the existing symbol
121
- return symbol;
122
- }
123
- // Add a new symbol with the specified parameters
124
- return this.add(named, {
125
- associate: associate ?? {},
126
- embed,
127
- useDomain,
128
- useSeparator,
129
- useToken: 'shared'
130
- });
131
- }
132
- /**
133
- * Retrieves the data associated with a given symbol from the Symkeys.
134
- *
135
- * This method allows access to the data that has been associated with a
136
- * particular symbol in the Symkeys. It is useful for retrieving stored
137
- * information when only the symbol is known.
138
- *
139
- * @param symbol - The symbol whose associated data is to be
140
- * retrieved.
141
- * @returns The data associated with the symbol, or undefined if
142
- * the symbol is not found in the Symkeys.
143
- *
144
- * @example
145
- * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys
146
- * // with associated data
147
- * const data = Symkeys.dataFor(mySymbol);
148
- * console.log(data); // Output: The data associated with 'mySymbol'
149
- */
150
- data(forSymbol) {
151
- return this[Symkeys.kDataKey].get(forSymbol);
152
- }
153
- /**
154
- * Deletes the data associated with a given symbol from the Symkeys.
155
- *
156
- * This method allows removal of the data that has been associated with a
157
- * particular symbol in the Symkeys. It is useful when you want to clean up
158
- * or remove stored information associated with a symbol.
159
- *
160
- * @param {Symbol} forSymbol - The symbol whose associated data is to be
161
- * deleted.
162
- * @param {*} replaceWith - Optionally, if `replaceWith` is not `undefined`,
163
- * a new value can be set after the original is deleted
164
- * @returns {boolean} - Returns true if an element in the Symkeys existed and
165
- * has been removed, or false if the element does not exist
166
- *
167
- * @example
168
- * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys
169
- * // with associated data
170
- * const isDeleted = Symkeys.deleteData(mySymbol);
171
- * console.log(isDeleted); // Output: true if data was deleted, false otherwise
172
- */
173
- deleteData(forSymbol, replaceWith = undefined) {
174
- if (this.hasData(forSymbol)) {
175
- const result = this[Symkeys.kDataKey].delete(forSymbol);
176
- if (replaceWith !== undefined) {
177
- this[Symkeys.kDataKey].set(forSymbol, replaceWith);
178
- }
179
- return result;
180
- }
181
- return false;
182
- }
183
- /**
184
- * Checks if the Symkeys instance has data associated with a given symbol.
185
- *
186
- * This method checks if the Symkeys instance has any data associated with
187
- * the provided symbol. It is useful when you need to verify if data exists
188
- * for a particular symbol before attempting to retrieve or manipulate it.
189
- *
190
- * @param {Symbol} forSymbol - The symbol to check for associated data.
191
- * @returns {boolean} Returns true if data exists for the symbol, false otherwise.
192
- *
193
- * @example
194
- * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys
195
- * // with associated data
196
- * const hasData = Symkeys.hasData(mySymbol);
197
- * console.log(hasData); // Output: true if data exists, false otherwise
198
- */
199
- hasData(forSymbol) {
200
- return this[Symkeys.kDataKey].has(forSymbol);
201
- }
202
- /**
203
- * Sets the data associated with a given symbol in the Symkeys.
204
- *
205
- * This method allows you to associate data with a particular symbol in the
206
- * Symkeys. It is useful when you want to store information that can be
207
- * retrieved later using the symbol.
208
- *
209
- * Note that setting only succeeds if the Symkey symbol has already been
210
- * added via {@link Symkeys.add}
211
- *
212
- * @param {Symbol} forSymbol - The symbol with which the data is to be
213
- * associated.
214
- * @param {*} value - The data to be associated with the symbol.
215
- * @returns {boolean} true if the value has been set, false if the key
216
- * has not yet been added via {@link Symkeys.add}
217
- *
218
- * @example
219
- * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys
220
- * // and 'myData' is the data to be associated with 'mySymbol'
221
- * Symkeys.setData(mySymbol, myData);
222
- */
223
- setData(forSymbol, value) {
224
- if (this.hasData(forSymbol)) {
225
- this[Symkeys.kDataKey].set(forSymbol, value);
226
- return true;
227
- }
228
- return false;
229
- }
230
- /**
231
- * Extracts the token part from a symbol created by the `add` method.
232
- *
233
- * This method parses the string representation of a symbol to retrieve
234
- * the unique token that was appended to the symbol's name upon creation.
235
- * It is useful for debugging or for operations that require knowledge of
236
- * the token associated with a symbol.
237
- *
238
- * @param symbol - The symbol whose token is to be extracted.
239
- * @returns The extracted token or undefined if the
240
- * token cannot be extracted.
241
- *
242
- * @example
243
- * // Assuming 'mySymbol' is a symbol created with the name 'myEntry'
244
- * // and a token 'agftofxob6f'
245
- * const token = Symkeys.tokenFor(mySymbol);
246
- * console.log(token); // Output: 'agftofxob6f'
247
- */
248
- token(forSymbol) {
249
- // Use a regular expression to match the token pattern in the symbol
250
- // description exists on symbol but our JS output target is too old
251
- return /^.* \#(.*?)$/.exec(forSymbol)?.description?.[1];
252
- }
253
- /**
254
- * Retrieves the separator used in the Symkeys instance.
255
- *
256
- * This getter method allows access to the separator that is used to
257
- * distinguish between different parts of a symbol in the Symkeys instance.
258
- * It is useful when you need to know the separator for parsing symbols or
259
- * constructing new ones.
260
- *
261
- * @returns {string} The separator used in the Symkeys instance.
262
- *
263
- * @example
264
- * // Assuming the Symkeys instance has a separator '.'
265
- * const separator = Symkeys.separator;
266
- * console.log(separator); // Output: '.'
267
- */
268
- get separator() {
269
- return this[kSeparator];
270
- }
271
- /**
272
- * Retrieves an iterator for the symbols stored in the Symkeys.
273
- *
274
- * This method provides access to the symbols that have been stored in
275
- * the Symkeys. It returns an iterator which can be used to loop over
276
- * all the symbols. This is particularly useful for iterating through
277
- * all stored data without knowing the individual symbols in advance.
278
- *
279
- * @returns An iterator that yields all the symbols
280
- * stored in the Symkeys.
281
- *
282
- * @example
283
- * // Assuming the Symkeys has symbols stored
284
- * for (const symbol of Symkeys.symbols()) {
285
- * console.log(symbol);
286
- * }
287
- */
288
- symbols() {
289
- // Retrieve the keys (symbols) from the Symkeys data map and return
290
- // the iterator.
291
- return this[Symkeys.kDataKey].keys();
292
- }
293
- /**
294
- * Calculates a name by combining a provided name, domain, and separator.
295
- *
296
- * This method takes a provided name, domain, and separator as input and
297
- * constructs a new name by combining these elements. If the domain or
298
- * separator are not provided, it uses the default domain and separator
299
- * stored in the Symkeys instance. If the provided name starts with the
300
- * separator, it removes the leading separator from the name.
301
- *
302
- * If the domain ends with the separator, it removes the trailing separator
303
- * from the domain. If the domain is empty, it sets the separator to an
304
- * empty string.
305
- *
306
- * @param {string} providedName - The name to be used in the calculation.
307
- * @param {string} [useDomain] - The domain to be used in the calculation.
308
- * If not provided, the default domain of the Symkeys instance is used.
309
- * @param {string} [useSeparator] - The separator to be used in the
310
- * calculation. If not provided, the default separator of the Symkeys
311
- * instance is used.
312
- * @returns {string} The calculated name.
313
- *
314
- * @example
315
- * // Assuming the Symkeys instance has a domain 'symkeys.internal'
316
- * // and a separator '.'
317
- * const name = Symkeys.calculateName('feature', 'symkeys.public', '/');
318
- * console.log(name); // Output: 'symkeys.public/feature'
319
- */
320
- calculateName(providedName, useDomain, useSeparator) {
321
- let domain = String(useDomain || this[Symkeys.kDomain]);
322
- let separator = String(useSeparator || this[Symkeys.kSeparator]);
323
- let postfix = (String(providedName).startsWith(separator)
324
- ? providedName.substring(1)
325
- : providedName);
326
- if (domain.length) {
327
- if (domain.endsWith(separator)) {
328
- domain = domain.substring(0, domain.length - 1);
329
- }
330
- }
331
- else {
332
- separator = '';
333
- }
334
- return `${domain}${separator}${postfix}`;
335
- }
336
- /**
337
- * Constructs a new instance of the Symkeys, setting up a proxy to
338
- * intercept and manage access to properties.
339
- *
340
- * This constructor initializes the Symkeys with a proxy that
341
- * overrides the default behavior for property access, checking, and
342
- * enumeration. It allows the Symkeys to behave like a map for its
343
- * own properties, while also maintaining the prototype chain.
344
- *
345
- * @param {string} domain an optional prefix string, to which the
346
- * `separator` parameter value will be guaranteed to have in between
347
- * the domain (if truthy) and the name of the added key.
348
- * @param {string} separator defaults to a period. So if your domain
349
- * is 'symkeys.internal' then calling {@link add()} with a name of
350
- * `"feature"` will result in the full name being
351
- * `"symkeys.internal.feature"`
352
- *
353
- * @example
354
- * const Symkeys = new Symkeys();
355
- * Symkeys[Symbol.for('myProperty')] = 'myValue';
356
- * console.log(Symkeys[Symbol.for('myProperty')]); // 'myValue'
357
- */
358
- constructor(domain = '', separator = '.') {
359
- // Create a prototype from the parent class to maintain the chain.
360
- const prototype = Object.create(Object.getPrototypeOf(this));
361
- // Store the original prototype for potential future use.
362
- this[Symkeys.kPrototype] = prototype;
363
- // Create map for this instance
364
- this[Symkeys.kDataKey] = new Map();
365
- // Store the domain
366
- this[Symkeys.kDomain] = (typeof domain === 'string' && domain);
367
- // Store the separator
368
- this[Symkeys.kSeparator] = separator;
369
- // Access the internal map that stores Symkeys data.
370
- const map = this[Symkeys.kDataKey];
371
- // Replace the instance's prototype with a proxy that manages
372
- // property access and manipulation.
373
- Object.setPrototypeOf(this, new Proxy(Object.create(prototype), {
374
- // Return the stored prototype for the target.
375
- getPrototypeOf(_) {
376
- return prototype;
377
- },
378
- // Intercept property access.
379
- get(target, property, receiver) {
380
- // If the property exists in the Symkeys map, return its value.
381
- if (map.has(property)) {
382
- return map.get(property);
383
- }
384
- // Otherwise, perform the default behavior.
385
- return Reflect.get(target, property, receiver);
386
- },
387
- // Check for property existence. Check both the Symkeys map and the target for
388
- // the property.
389
- has(target, property) {
390
- return map.has(property) || Reflect.has(target, property);
391
- },
392
- // Retrieve all property keys. Combine keys from the Symkeys map and the target.
393
- ownKeys(target) {
394
- return [...Array.from(map.keys()), ...Reflect.ownKeys(target)];
395
- },
396
- // Intercept property assignment.
397
- set(_, property, value, __) {
398
- // If the property exists in the Symkeys map, set its value.
399
- if (map.has(property)) {
400
- map.set(property, value);
401
- return true;
402
- }
403
- // If not, the operation is not allowed.
404
- return false;
405
- },
406
- // Retrieve property descriptors.
407
- getOwnPropertyDescriptor(_, property) {
408
- // Convert the Symkeys map to an object to use with
409
- // Object.getOwnPropertyDescriptor.
410
- const object = [...map.entries()].reduce((a, e) => Object.assign(a, { [e[0]]: e[1] }), {});
411
- // Retrieve the descriptor from the object.
412
- return Object.getOwnPropertyDescriptor(object, property);
413
- },
414
- }));
415
- }
416
- /**
417
- * Checks if a given value is a Symkey.
418
- *
419
- * This method checks if the provided value is a Symkey. A Symkey is a
420
- * symbol that matches a specific pattern. The pattern is defined as a
421
- * symbol that starts with '@', followed by any characters, a space, a '#',
422
- * and ends with one or more word characters.
423
- *
424
- * @param {Symbol} value - The value to check.
425
- * @returns {boolean} Returns true if the value is a Symkey, false otherwise.
426
- *
427
- * @example
428
- * // Check if a symbol is a Symkey:
429
- * const sym = Symbol('@nejs.prototype #rwiy2o905d');
430
- * console.log(Symkeys.isSymkey(sym)); // Outputs: true
431
- */
432
- static isSymkey(value) {
433
- if (!(typeof value === 'symbol' || value instanceof Symbol)) {
434
- return false;
435
- }
436
- return !!/^@.*? #\w+$/.exec(value?.description);
437
- }
438
- /**
439
- * Generates a random token string.
440
- *
441
- * This method creates a pseudo-random token that can be used for various
442
- * purposes within the library, such as generating unique identifiers or
443
- * keys. The token is generated using a base 36 encoding, which includes
444
- * numbers and lowercase letters.
445
- *
446
- * @returns A random token string.
447
- *
448
- * @example
449
- * // Example of getting a random token:
450
- * const token = MyClass.token;
451
- * console.log(token); // Outputs a string like 'qg6k1zr0is'
452
- */
453
- static get token() {
454
- return Math.random().toString(36).slice(2);
455
- }
456
- /**
457
- * Reusable publicly static key for identifying where data is stored.
458
- */
459
- static get kDataKey() {
460
- return Symbol.for('symkeys.data');
461
- }
462
- /**
463
- * Reusable publicly static key for identifying where data is stored.
464
- */
465
- static get kPrototype() {
466
- return Symbol.for('symkeys.prototype');
467
- }
468
- /**
469
- * A static getter that returns a unique, reusable symbol for 'symkeys.domain'.
470
- *
471
- * This getter is used to create a unique symbol that can be used as a key
472
- * for storing and retrieving domain-specific data in the Symkeys. The symbol
473
- * is created using the `Symbol.for` method, which ensures that the same
474
- * symbol is returned for a given key, in this case 'symkeys.domain'.
475
- *
476
- * @returns {Symbol} A unique symbol for 'symkeys.domain'.
477
- *
478
- * @example
479
- * // Retrieve the 'symkeys.domain' symbol
480
- * const domainSymbol = Symkeys.kDomain;
481
- * console.log(domainSymbol); // Outputs: Symbol(symkeys.domain)
482
- */
483
- static get kDomain() {
484
- return Symbol.for('symkeys.domain');
485
- }
486
- /**
487
- * A static getter that returns a unique, reusable symbol for 'symkeys.separator'.
488
- *
489
- * This getter is used to create a unique symbol that can be used as a key
490
- * for storing and retrieving separator-specific data in the Symkeys. The symbol
491
- * is created using the `Symbol.for` method, which ensures that the same
492
- * symbol is returned for a given key, in this case 'symkeys.separator'.
493
- *
494
- * @returns {Symbol} A unique symbol for 'symkeys.separator'.
495
- *
496
- * @example
497
- * // Retrieve the 'symkeys.separator' symbol
498
- * const separatorSymbol = Symkeys.kSeparator;
499
- * console.log(separatorSymbol); // Outputs: Symbol(symkeys.separator)
500
- */
501
- static get kSeparator() {
502
- return Symbol.for('symkeys.separator');
503
- }
504
- }
505
- export const SymkeysExtension = new Extension(Symkeys);
506
- //# sourceMappingURL=symkeys.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"symkeys.js","sourceRoot":"","sources":["../../../src/classes/symkeys.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C;;;;;;;;;;;;;;;EAeE;AACF,MAAM,OAAO,OAAO;IAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,GAAG,CACD,KAAK,EACL,EACE,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,SAAS,EACjB,SAAS,GAAG,SAAS,EACrB,YAAY,GAAG,SAAS,EACxB,QAAQ,GAAG,SAAS,GACrB;QAED,yCAAyC;QACzC,MAAM,KAAK,GAAG,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAA;QAEvC,0DAA0D;QAC1D,IAAI,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,CAAC,CAAA;QAEhE,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvC,IAAI,CAAC;gBACH,OAAO,IAAI,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F,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK;QACnB,IAAI,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC,EAAE,CAAC;YAC5D,OAAO,KAAK,CAAA;QACd,CAAC;QAED,OAAO,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;IACjD,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,KAAK,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,QAAQ;QACjB,OAAO,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,UAAU;QACnB,OAAO,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;IACxC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,KAAK,OAAO;QAChB,OAAO,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;IACrC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,KAAK,UAAU;QACnB,OAAO,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;IACxC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,CAAA"}
@@ -1,56 +0,0 @@
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" | "undefined" | "boolean" | "string" | "symbol", void, unknown>;
8
- static get typeOfTypes(): () => Generator<"function" | "object" | "number" | "bigint" | "undefined" | "boolean" | "string" | "symbol", void, unknown>;
9
- static mapped: Map<string | undefined, ObjectConstructor | undefined>;
10
- mapped: Map<string | undefined, ObjectConstructor | 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';