@lumjs/core 1.30.0 → 1.31.1
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.
- package/README.md +1 -1
- package/jsdoc.js +13 -0
- package/lib/enum.js +38 -9
- package/lib/events/event.js +85 -0
- package/lib/events/index.js +42 -0
- package/lib/events/listener.js +127 -0
- package/lib/events/registry.js +737 -0
- package/lib/index.js +26 -2
- package/lib/meta.js +15 -6
- package/lib/obj/copyprops.js +1 -1
- package/lib/obj/cp.js +1375 -0
- package/lib/obj/flip.js +2 -0
- package/lib/obj/index.js +2 -1
- package/lib/objectid.js +7 -0
- package/lib/state.js +61 -0
- package/lib/types/basics.js +6 -14
- package/lib/types/dt.js +3 -3
- package/lib/types/index.js +0 -3
- package/lib/types/js.js +21 -2
- package/lib/types/typelist.js +6 -4
- package/lum.build.js +11 -0
- package/package.json +19 -13
- package/TODO.md +0 -76
- package/jsdoc.json +0 -33
package/lib/index.js
CHANGED
|
@@ -22,6 +22,7 @@ const types = require('./types');
|
|
|
22
22
|
/**
|
|
23
23
|
* Define properties on an object or function
|
|
24
24
|
* @name module:@lumjs/core.def
|
|
25
|
+
* @function
|
|
25
26
|
* @see module:@lumjs/core/types.def
|
|
26
27
|
*/
|
|
27
28
|
const def = types.def;
|
|
@@ -29,6 +30,7 @@ const def = types.def;
|
|
|
29
30
|
/**
|
|
30
31
|
* Define *lazy* properties on an object or function
|
|
31
32
|
* @alias module:@lumjs/core.lazy
|
|
33
|
+
* @function
|
|
32
34
|
* @see module:@lumjs/core/types.lazy
|
|
33
35
|
*/
|
|
34
36
|
const lazy = types.lazy;
|
|
@@ -37,6 +39,9 @@ def(exports, 'types', types);
|
|
|
37
39
|
def(exports, 'def', def);
|
|
38
40
|
def(exports, 'lazy', lazy);
|
|
39
41
|
|
|
42
|
+
// TODO: document
|
|
43
|
+
def(exports, 'state', require('./state'));
|
|
44
|
+
|
|
40
45
|
/**
|
|
41
46
|
* Array utility functions «Lazy»
|
|
42
47
|
* @name module:@lumjs/core.arrays
|
|
@@ -80,7 +85,7 @@ lazy(exports, 'flags', () => require('./flags'));
|
|
|
80
85
|
lazy(exports, 'obj', () => require('./obj'));
|
|
81
86
|
|
|
82
87
|
/**
|
|
83
|
-
* A wrapper around the Javascript console
|
|
88
|
+
* A wrapper around the Javascript console «Lazy»
|
|
84
89
|
* @name module:@lumjs/core.console
|
|
85
90
|
* @type {module:@lumjs/core/console}
|
|
86
91
|
*/
|
|
@@ -138,7 +143,20 @@ from(require('./objectid'));
|
|
|
138
143
|
* @see module:@lumjs/core/meta.NYI
|
|
139
144
|
*/
|
|
140
145
|
|
|
141
|
-
|
|
146
|
+
/**
|
|
147
|
+
* A function indicating that something is deprecated
|
|
148
|
+
* @name module:@lumjs/core.deprecated
|
|
149
|
+
* @function
|
|
150
|
+
* @see module:@lumjs/core/meta.deprecated
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Assign a getter property to an object that calls the `deprecated`
|
|
155
|
+
* function with a specific message before returning the proxied value.
|
|
156
|
+
* @name module:@lumjs/core.wrapDepr
|
|
157
|
+
* @function
|
|
158
|
+
* @see module:@lumjs/core/meta.wrapDepre
|
|
159
|
+
*/
|
|
142
160
|
|
|
143
161
|
// These are exported directly, but a meta sub-module also exists.
|
|
144
162
|
// Unlike most sub-modules there is no `meta` property in the main library.
|
|
@@ -165,3 +183,9 @@ lazy(exports, 'Enum', () => require('./enum'));
|
|
|
165
183
|
*/
|
|
166
184
|
lazy(exports, 'observable', () => require('./observable'));
|
|
167
185
|
|
|
186
|
+
/**
|
|
187
|
+
* The Events module «Lazy»
|
|
188
|
+
* @name module:@lumjs/core.events
|
|
189
|
+
* @see module:@lumjs/core/events
|
|
190
|
+
*/
|
|
191
|
+
lazy(exports, 'events', () => require('./events'));
|
package/lib/meta.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Meta-programming helpers
|
|
4
|
+
*
|
|
5
|
+
* All of the function exported by this module are also available
|
|
6
|
+
* in the main {@link module:@lumjs/core core object} itself.
|
|
7
|
+
*
|
|
8
|
+
* @module @lumjs/core/meta
|
|
9
|
+
*/
|
|
2
10
|
|
|
3
11
|
const {F} = require('./types/js');
|
|
4
12
|
|
|
@@ -13,7 +21,7 @@ const {F} = require('./types/js');
|
|
|
13
21
|
* @param {string} [msg] - A message for the Error object.
|
|
14
22
|
*
|
|
15
23
|
* @returns {string[]} An array of stack strings.
|
|
16
|
-
* @alias module:@lumjs/core.stacktrace
|
|
24
|
+
* @alias module:@lumjs/core/meta.stacktrace
|
|
17
25
|
*/
|
|
18
26
|
function stacktrace(msg)
|
|
19
27
|
{
|
|
@@ -50,7 +58,7 @@ exports.stacktrace = stacktrace;
|
|
|
50
58
|
* }
|
|
51
59
|
* ```
|
|
52
60
|
*
|
|
53
|
-
* @alias module:@lumjs/core.AbstractError
|
|
61
|
+
* @alias module:@lumjs/core/meta.AbstractError
|
|
54
62
|
*/
|
|
55
63
|
class AbstractError extends Error
|
|
56
64
|
{
|
|
@@ -82,8 +90,7 @@ exports.AbstractError = AbstractError;
|
|
|
82
90
|
|
|
83
91
|
/**
|
|
84
92
|
* Function prototypes for async, generator, and async generator functions.
|
|
85
|
-
* @
|
|
86
|
-
* @alias module:@lumjs/core.Functions
|
|
93
|
+
* @alias module:@lumjs/core/meta.Functions
|
|
87
94
|
*/
|
|
88
95
|
const Functions =
|
|
89
96
|
{
|
|
@@ -114,7 +121,7 @@ exports.Functions = Functions;
|
|
|
114
121
|
* @param {string} [prefix=''] A prefix for the error message.
|
|
115
122
|
*
|
|
116
123
|
* @returns {void}
|
|
117
|
-
* @alias module:@lumjs/core.NYI
|
|
124
|
+
* @alias module:@lumjs/core/meta.NYI
|
|
118
125
|
*/
|
|
119
126
|
function NYI(fatal=true, prefix='')
|
|
120
127
|
{
|
|
@@ -134,7 +141,7 @@ exports.NYI = NYI;
|
|
|
134
141
|
* @param {(string|string[])} [rep] Replacement suggestion(s).
|
|
135
142
|
* @param {*} [ret] Value to return
|
|
136
143
|
* @returns {mixed} `ret`
|
|
137
|
-
* @alias module:@lumjs/core.deprecated
|
|
144
|
+
* @alias module:@lumjs/core/meta.deprecated
|
|
138
145
|
*/
|
|
139
146
|
function deprecated(dep, rep, ret)
|
|
140
147
|
{
|
|
@@ -167,6 +174,8 @@ exports.deprecated = deprecated;
|
|
|
167
174
|
* @param {object} [spec.opts] Options for `def()` to add getter with.
|
|
168
175
|
*
|
|
169
176
|
* @returns {object} `obj`
|
|
177
|
+
*
|
|
178
|
+
* @alias module:@lumjs/core/meta.wrapDepr
|
|
170
179
|
*/
|
|
171
180
|
function wrapDepr(obj,prop,spec)
|
|
172
181
|
{
|