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