@nejs/basic-extensions 2.21.0 → 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 (270) hide show
  1. package/.idea/markdown.xml +8 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/ne-basic-extensions.iml +8 -0
  4. package/.idea/vcs.xml +6 -0
  5. package/CODE_STYLE.md +393 -0
  6. package/CODING_PHILOSOPHY.md +36 -0
  7. package/DOCUMENTATION_GUIDELINES.md +221 -0
  8. package/README.md +78 -4
  9. package/dist/@nejs/basic-extensions.bundle.2.22.6.js +25 -0
  10. package/dist/@nejs/basic-extensions.bundle.2.22.6.js.map +7 -0
  11. package/dist/cjs/classes/index.cjs +11129 -0
  12. package/dist/cjs/classes/index.cjs.map +7 -0
  13. package/dist/cjs/index.cjs +15191 -0
  14. package/dist/cjs/index.cjs.map +7 -0
  15. package/dist/cjs/utils/index.cjs +3954 -0
  16. package/dist/cjs/utils/index.cjs.map +7 -0
  17. package/dist/esm/basic-extensions.mjs +25 -0
  18. package/dist/esm/basic-extensions.mjs.map +7 -0
  19. package/package.json +16 -22
  20. package/repl.bootstrap.js +4 -7
  21. package/repl.history +30 -30
  22. package/src/big.int.extension.js +171 -45
  23. package/src/classes/enumeration.js +466 -0
  24. package/src/classes/index.js +5 -1
  25. package/src/index.js +5 -1
  26. package/src/math.extension.js +73 -0
  27. package/src/number.extension.js +18 -0
  28. package/src/regular.expression.extensions.js +0 -35
  29. package/src/utils/toolkit.js +699 -516
  30. package/tests/arrayextensions.test.js +3 -3
  31. package/tests/index.test.js +3 -1
  32. package/tests/newClasses/asyncIterable.test.js +3 -3
  33. package/tests/newClasses/deferred.test.js +3 -3
  34. package/tests/newClasses/descriptor.test.js +3 -3
  35. package/tests/newClasses/iterable.test.js +3 -3
  36. package/tests/newClasses/refmap.test.js +3 -3
  37. package/tests/newClasses/refset.test.js +3 -3
  38. package/tests/objectextensions.test.js +3 -3
  39. package/tests/setextensions.test.js +3 -3
  40. package/tests/stringextensions.test.js +3 -2
  41. package/tests/utils/descriptor.utils.test.js +1 -1
  42. package/tests/utils/toolkit.test.js +429 -163
  43. package/.esdoc.json +0 -9
  44. package/.vscode/settings.json +0 -5
  45. package/bin/build +0 -27
  46. package/bin/clean +0 -14
  47. package/bin/esbuild +0 -91
  48. package/bin/fixup +0 -13
  49. package/bin/repl.basics.js +0 -584
  50. package/bin/repl.signature.js +0 -63
  51. package/bin/version +0 -100
  52. package/dist/@nejs/basic-extensions.bundle.2.21.0.js +0 -25
  53. package/dist/@nejs/basic-extensions.bundle.2.21.0.js.map +0 -7
  54. package/dist/cjs/array.extensions.d.ts +0 -39
  55. package/dist/cjs/array.extensions.js +0 -477
  56. package/dist/cjs/array.extensions.js.map +0 -1
  57. package/dist/cjs/big.int.extension.d.ts +0 -31
  58. package/dist/cjs/big.int.extension.js +0 -165
  59. package/dist/cjs/big.int.extension.js.map +0 -1
  60. package/dist/cjs/classes/asyncIterable.d.ts +0 -126
  61. package/dist/cjs/classes/asyncIterable.js +0 -209
  62. package/dist/cjs/classes/asyncIterable.js.map +0 -1
  63. package/dist/cjs/classes/deferred.d.ts +0 -146
  64. package/dist/cjs/classes/deferred.js +0 -291
  65. package/dist/cjs/classes/deferred.js.map +0 -1
  66. package/dist/cjs/classes/descriptor.d.ts +0 -334
  67. package/dist/cjs/classes/descriptor.js +0 -537
  68. package/dist/cjs/classes/descriptor.js.map +0 -1
  69. package/dist/cjs/classes/enum.d.ts +0 -50
  70. package/dist/cjs/classes/enum.js +0 -405
  71. package/dist/cjs/classes/enum.js.map +0 -1
  72. package/dist/cjs/classes/index.d.ts +0 -15
  73. package/dist/cjs/classes/index.js +0 -63
  74. package/dist/cjs/classes/index.js.map +0 -1
  75. package/dist/cjs/classes/introspector.d.ts +0 -20
  76. package/dist/cjs/classes/introspector.js +0 -130
  77. package/dist/cjs/classes/introspector.js.map +0 -1
  78. package/dist/cjs/classes/iterable.d.ts +0 -169
  79. package/dist/cjs/classes/iterable.js +0 -268
  80. package/dist/cjs/classes/iterable.js.map +0 -1
  81. package/dist/cjs/classes/param.parser.d.ts +0 -221
  82. package/dist/cjs/classes/param.parser.js +0 -242
  83. package/dist/cjs/classes/param.parser.js.map +0 -1
  84. package/dist/cjs/classes/pluggable.proxy.d.ts +0 -153
  85. package/dist/cjs/classes/pluggable.proxy.js +0 -444
  86. package/dist/cjs/classes/pluggable.proxy.js.map +0 -1
  87. package/dist/cjs/classes/property.d.ts +0 -79
  88. package/dist/cjs/classes/property.js +0 -284
  89. package/dist/cjs/classes/property.js.map +0 -1
  90. package/dist/cjs/classes/refmap.d.ts +0 -238
  91. package/dist/cjs/classes/refmap.js +0 -421
  92. package/dist/cjs/classes/refmap.js.map +0 -1
  93. package/dist/cjs/classes/refset.d.ts +0 -186
  94. package/dist/cjs/classes/refset.js +0 -370
  95. package/dist/cjs/classes/refset.js.map +0 -1
  96. package/dist/cjs/classes/symkeys.d.ts +0 -349
  97. package/dist/cjs/classes/symkeys.js +0 -510
  98. package/dist/cjs/classes/symkeys.js.map +0 -1
  99. package/dist/cjs/classes/type.d.ts +0 -56
  100. package/dist/cjs/classes/type.js +0 -405
  101. package/dist/cjs/classes/type.js.map +0 -1
  102. package/dist/cjs/function.extensions.d.ts +0 -12
  103. package/dist/cjs/function.extensions.js +0 -758
  104. package/dist/cjs/function.extensions.js.map +0 -1
  105. package/dist/cjs/global.this.d.ts +0 -2
  106. package/dist/cjs/global.this.js +0 -300
  107. package/dist/cjs/global.this.js.map +0 -1
  108. package/dist/cjs/index.d.ts +0 -31
  109. package/dist/cjs/index.js +0 -226
  110. package/dist/cjs/index.js.map +0 -1
  111. package/dist/cjs/json.extensions.d.ts +0 -2
  112. package/dist/cjs/json.extensions.js +0 -109
  113. package/dist/cjs/json.extensions.js.map +0 -1
  114. package/dist/cjs/map.extensions.d.ts +0 -3
  115. package/dist/cjs/map.extensions.js +0 -143
  116. package/dist/cjs/map.extensions.js.map +0 -1
  117. package/dist/cjs/number.extension.d.ts +0 -44
  118. package/dist/cjs/number.extension.js +0 -261
  119. package/dist/cjs/number.extension.js.map +0 -1
  120. package/dist/cjs/object.extensions.d.ts +0 -33
  121. package/dist/cjs/object.extensions.js +0 -1091
  122. package/dist/cjs/object.extensions.js.map +0 -1
  123. package/dist/cjs/package.json +0 -3
  124. package/dist/cjs/proxy.extensions.d.ts +0 -2
  125. package/dist/cjs/proxy.extensions.js +0 -207
  126. package/dist/cjs/proxy.extensions.js.map +0 -1
  127. package/dist/cjs/reflect.extensions.d.ts +0 -14
  128. package/dist/cjs/reflect.extensions.js +0 -316
  129. package/dist/cjs/reflect.extensions.js.map +0 -1
  130. package/dist/cjs/regular.expression.extensions.d.ts +0 -2
  131. package/dist/cjs/regular.expression.extensions.js +0 -423
  132. package/dist/cjs/regular.expression.extensions.js.map +0 -1
  133. package/dist/cjs/set.extensions.d.ts +0 -40
  134. package/dist/cjs/set.extensions.js +0 -355
  135. package/dist/cjs/set.extensions.js.map +0 -1
  136. package/dist/cjs/string.extensions.d.ts +0 -23
  137. package/dist/cjs/string.extensions.js +0 -704
  138. package/dist/cjs/string.extensions.js.map +0 -1
  139. package/dist/cjs/symbol.extensions.d.ts +0 -11
  140. package/dist/cjs/symbol.extensions.js +0 -735
  141. package/dist/cjs/symbol.extensions.js.map +0 -1
  142. package/dist/cjs/utils/copy.object.d.ts +0 -408
  143. package/dist/cjs/utils/copy.object.js +0 -720
  144. package/dist/cjs/utils/copy.object.js.map +0 -1
  145. package/dist/cjs/utils/descriptor.utils.d.ts +0 -298
  146. package/dist/cjs/utils/descriptor.utils.js +0 -889
  147. package/dist/cjs/utils/descriptor.utils.js.map +0 -1
  148. package/dist/cjs/utils/index.d.ts +0 -75
  149. package/dist/cjs/utils/index.js +0 -61
  150. package/dist/cjs/utils/index.js.map +0 -1
  151. package/dist/cjs/utils/stdout.d.ts +0 -742
  152. package/dist/cjs/utils/stdout.js +0 -1042
  153. package/dist/cjs/utils/stdout.js.map +0 -1
  154. package/dist/cjs/utils/toolkit.d.ts +0 -1898
  155. package/dist/cjs/utils/toolkit.js +0 -1378
  156. package/dist/cjs/utils/toolkit.js.map +0 -1
  157. package/dist/cjs/weakref.extensions.d.ts +0 -2
  158. package/dist/cjs/weakref.extensions.js +0 -19
  159. package/dist/cjs/weakref.extensions.js.map +0 -1
  160. package/dist/mjs/array.extensions.d.ts +0 -39
  161. package/dist/mjs/array.extensions.js +0 -474
  162. package/dist/mjs/array.extensions.js.map +0 -1
  163. package/dist/mjs/big.int.extension.d.ts +0 -31
  164. package/dist/mjs/big.int.extension.js +0 -162
  165. package/dist/mjs/big.int.extension.js.map +0 -1
  166. package/dist/mjs/classes/asyncIterable.d.ts +0 -126
  167. package/dist/mjs/classes/asyncIterable.js +0 -204
  168. package/dist/mjs/classes/asyncIterable.js.map +0 -1
  169. package/dist/mjs/classes/deferred.d.ts +0 -146
  170. package/dist/mjs/classes/deferred.js +0 -287
  171. package/dist/mjs/classes/deferred.js.map +0 -1
  172. package/dist/mjs/classes/descriptor.d.ts +0 -334
  173. package/dist/mjs/classes/descriptor.js +0 -533
  174. package/dist/mjs/classes/descriptor.js.map +0 -1
  175. package/dist/mjs/classes/enum.d.ts +0 -50
  176. package/dist/mjs/classes/enum.js +0 -400
  177. package/dist/mjs/classes/enum.js.map +0 -1
  178. package/dist/mjs/classes/index.d.ts +0 -15
  179. package/dist/mjs/classes/index.js +0 -46
  180. package/dist/mjs/classes/index.js.map +0 -1
  181. package/dist/mjs/classes/introspector.d.ts +0 -20
  182. package/dist/mjs/classes/introspector.js +0 -126
  183. package/dist/mjs/classes/introspector.js.map +0 -1
  184. package/dist/mjs/classes/iterable.d.ts +0 -169
  185. package/dist/mjs/classes/iterable.js +0 -263
  186. package/dist/mjs/classes/iterable.js.map +0 -1
  187. package/dist/mjs/classes/param.parser.d.ts +0 -221
  188. package/dist/mjs/classes/param.parser.js +0 -238
  189. package/dist/mjs/classes/param.parser.js.map +0 -1
  190. package/dist/mjs/classes/pluggable.proxy.d.ts +0 -153
  191. package/dist/mjs/classes/pluggable.proxy.js +0 -438
  192. package/dist/mjs/classes/pluggable.proxy.js.map +0 -1
  193. package/dist/mjs/classes/property.d.ts +0 -79
  194. package/dist/mjs/classes/property.js +0 -280
  195. package/dist/mjs/classes/property.js.map +0 -1
  196. package/dist/mjs/classes/refmap.d.ts +0 -238
  197. package/dist/mjs/classes/refmap.js +0 -417
  198. package/dist/mjs/classes/refmap.js.map +0 -1
  199. package/dist/mjs/classes/refset.d.ts +0 -186
  200. package/dist/mjs/classes/refset.js +0 -366
  201. package/dist/mjs/classes/refset.js.map +0 -1
  202. package/dist/mjs/classes/symkeys.d.ts +0 -349
  203. package/dist/mjs/classes/symkeys.js +0 -506
  204. package/dist/mjs/classes/symkeys.js.map +0 -1
  205. package/dist/mjs/classes/type.d.ts +0 -56
  206. package/dist/mjs/classes/type.js +0 -401
  207. package/dist/mjs/classes/type.js.map +0 -1
  208. package/dist/mjs/function.extensions.d.ts +0 -12
  209. package/dist/mjs/function.extensions.js +0 -755
  210. package/dist/mjs/function.extensions.js.map +0 -1
  211. package/dist/mjs/global.this.d.ts +0 -2
  212. package/dist/mjs/global.this.js +0 -264
  213. package/dist/mjs/global.this.js.map +0 -1
  214. package/dist/mjs/index.d.ts +0 -31
  215. package/dist/mjs/index.js +0 -204
  216. package/dist/mjs/index.js.map +0 -1
  217. package/dist/mjs/json.extensions.d.ts +0 -2
  218. package/dist/mjs/json.extensions.js +0 -106
  219. package/dist/mjs/json.extensions.js.map +0 -1
  220. package/dist/mjs/map.extensions.d.ts +0 -3
  221. package/dist/mjs/map.extensions.js +0 -140
  222. package/dist/mjs/map.extensions.js.map +0 -1
  223. package/dist/mjs/number.extension.d.ts +0 -44
  224. package/dist/mjs/number.extension.js +0 -258
  225. package/dist/mjs/number.extension.js.map +0 -1
  226. package/dist/mjs/object.extensions.d.ts +0 -33
  227. package/dist/mjs/object.extensions.js +0 -1088
  228. package/dist/mjs/object.extensions.js.map +0 -1
  229. package/dist/mjs/package.json +0 -3
  230. package/dist/mjs/proxy.extensions.d.ts +0 -2
  231. package/dist/mjs/proxy.extensions.js +0 -204
  232. package/dist/mjs/proxy.extensions.js.map +0 -1
  233. package/dist/mjs/reflect.extensions.d.ts +0 -14
  234. package/dist/mjs/reflect.extensions.js +0 -313
  235. package/dist/mjs/reflect.extensions.js.map +0 -1
  236. package/dist/mjs/regular.expression.extensions.d.ts +0 -2
  237. package/dist/mjs/regular.expression.extensions.js +0 -420
  238. package/dist/mjs/regular.expression.extensions.js.map +0 -1
  239. package/dist/mjs/set.extensions.d.ts +0 -40
  240. package/dist/mjs/set.extensions.js +0 -352
  241. package/dist/mjs/set.extensions.js.map +0 -1
  242. package/dist/mjs/string.extensions.d.ts +0 -23
  243. package/dist/mjs/string.extensions.js +0 -701
  244. package/dist/mjs/string.extensions.js.map +0 -1
  245. package/dist/mjs/symbol.extensions.d.ts +0 -11
  246. package/dist/mjs/symbol.extensions.js +0 -732
  247. package/dist/mjs/symbol.extensions.js.map +0 -1
  248. package/dist/mjs/utils/copy.object.d.ts +0 -408
  249. package/dist/mjs/utils/copy.object.js +0 -702
  250. package/dist/mjs/utils/copy.object.js.map +0 -1
  251. package/dist/mjs/utils/descriptor.utils.d.ts +0 -298
  252. package/dist/mjs/utils/descriptor.utils.js +0 -875
  253. package/dist/mjs/utils/descriptor.utils.js.map +0 -1
  254. package/dist/mjs/utils/index.d.ts +0 -75
  255. package/dist/mjs/utils/index.js +0 -45
  256. package/dist/mjs/utils/index.js.map +0 -1
  257. package/dist/mjs/utils/stdout.d.ts +0 -742
  258. package/dist/mjs/utils/stdout.js +0 -1037
  259. package/dist/mjs/utils/stdout.js.map +0 -1
  260. package/dist/mjs/utils/toolkit.d.ts +0 -1898
  261. package/dist/mjs/utils/toolkit.js +0 -1373
  262. package/dist/mjs/utils/toolkit.js.map +0 -1
  263. package/dist/mjs/weakref.extensions.d.ts +0 -2
  264. package/dist/mjs/weakref.extensions.js +0 -16
  265. package/dist/mjs/weakref.extensions.js.map +0 -1
  266. package/jsdoc-config.json +0 -31
  267. package/tsconfig.base.json +0 -28
  268. package/tsconfig.cjs.json +0 -8
  269. package/tsconfig.esm.json +0 -8
  270. 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,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AC3C,OAAO,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC3D,CAAC;SACF,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';