@lumjs/core 1.38.1 → 1.38.3
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/lib/arrays/index.js +1 -1
- package/lib/arrays/typed.js +139 -0
- package/lib/events/index.js +103 -70
- package/lib/events/observable.js +2 -237
- package/lib/index.js +13 -12
- package/lib/meta.js +2 -2
- package/lib/obj/assignd.js +52 -5
- package/lib/obj/df.js +221 -74
- package/lib/obj/getprotos.js +25 -0
- package/lib/obj/index.js +26 -6
- package/lib/obj/ns.js +96 -20
- package/lib/objectid.js +43 -13
- package/lib/observable.js +1 -0
- package/lib/types/basics.js +29 -3
- package/lib/types/def.js +4 -1
- package/lib/types/index.js +10 -2
- package/lib/types/isa.js +4 -4
- package/lib/types/lazy.js +12 -219
- package/package.json +3 -2
- package/lib/events/event.js +0 -89
- package/lib/events/listener.js +0 -139
- package/lib/events/registry.js +0 -875
package/lib/obj/ns.js
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
const
|
|
3
3
|
{
|
|
4
4
|
B, S,
|
|
5
|
-
root, isObj, needObj, def, nonEmptyArray, isNil,
|
|
5
|
+
root, isObj, needObj, def, nonEmptyArray, isNil,
|
|
6
6
|
doesDescriptorTemplate,
|
|
7
7
|
} = require('../types');
|
|
8
8
|
|
|
9
|
+
const {df} = require('./df');
|
|
10
|
+
const cp = Object.assign;
|
|
11
|
+
|
|
9
12
|
/**
|
|
10
13
|
* Need a String or Array
|
|
11
14
|
* @alias module:@lumjs/core/obj.SOA
|
|
@@ -79,9 +82,13 @@ exports.nsArray = nsArray;
|
|
|
79
82
|
*
|
|
80
83
|
* @param {(object|function)} obj - Object we're looking in.
|
|
81
84
|
* @param {(string|Array)} proppath - Property path we're looking for.
|
|
82
|
-
*
|
|
85
|
+
*
|
|
86
|
+
* Generally a string of dot (`.`) separated nested property names.
|
|
87
|
+
*
|
|
83
88
|
* @param {(object|boolean)} [opts] Options changing the behaviours.
|
|
84
|
-
*
|
|
89
|
+
*
|
|
90
|
+
* If this is a `boolean` it's assumed to be the `opts.log` option.
|
|
91
|
+
*
|
|
85
92
|
* @param {boolean} [opts.log=false] Log errors for missing namespaces?
|
|
86
93
|
* @param {boolean} [opts.allowFun=true] Allow `obj` to be a `function` ?
|
|
87
94
|
*
|
|
@@ -129,15 +136,33 @@ exports.getObjectPath = getObjectPath;
|
|
|
129
136
|
*
|
|
130
137
|
* @param {(object|function)} obj - Object the property path is for.
|
|
131
138
|
* @param {(string|Array)} proppath - Property path to create.
|
|
132
|
-
* @param {object} [opts] Options changing the behaviours.
|
|
139
|
+
* @param {(object|boolean)} [opts] Options changing the behaviours.
|
|
140
|
+
*
|
|
141
|
+
* If this is a `boolean` it's assumed to be the `opts.overwrite` option.
|
|
142
|
+
*
|
|
133
143
|
* @param {*} [opts.value] A value to assign to the last property path.
|
|
134
144
|
* @param {boolean} [opts.overwrite=false] Allow overwriting property paths.
|
|
135
|
-
*
|
|
145
|
+
*
|
|
146
|
+
* Only applicable if `opts.value` was also specified.
|
|
147
|
+
*
|
|
136
148
|
* @param {object} [opts.desc] Descriptor rules for defining the properties.
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
149
|
+
*
|
|
150
|
+
* Must NOT contain `value`, `get`, or `set` properties.
|
|
151
|
+
* Only, `configurable`, `enumerable`, and `writable` are supported.
|
|
152
|
+
* Will be ignored if `opts.assign` is `true`.
|
|
153
|
+
*
|
|
154
|
+
* NOTE: This option will likely be removed in version 2.x, as you can
|
|
155
|
+
* use `opts.df` to set descriptor rules instead.
|
|
156
|
+
*
|
|
140
157
|
* @param {boolean} [opts.assign=false] Use direct assignment instead of `def()`.
|
|
158
|
+
* @param {(boolean|object)} [opts.df] Use `df()` instead of `def()`?
|
|
159
|
+
*
|
|
160
|
+
* If this is an object, it will be used as options for the df() function.
|
|
161
|
+
*
|
|
162
|
+
* NOTE: In version 2.x, the boolean use of this option will be removed,
|
|
163
|
+
* as df() will replace def() entirely in that release.
|
|
164
|
+
*
|
|
165
|
+
* @param {boolean} [opts.allowFun=true] See getObjectPath() for details.
|
|
141
166
|
* @param {boolean} [opts.returnThis=false] Return `this` variable.
|
|
142
167
|
* @param {boolean} [opts.returnObj=false] Return the `obj` parameter.
|
|
143
168
|
* @return {*} Generally the last object in the nested property paths.
|
|
@@ -146,28 +171,35 @@ exports.getObjectPath = getObjectPath;
|
|
|
146
171
|
*/
|
|
147
172
|
function setObjectPath(obj, proppath, opts={})
|
|
148
173
|
{
|
|
149
|
-
|
|
150
|
-
|
|
174
|
+
if (typeof opts === B)
|
|
175
|
+
opts = {overwrite: opts};
|
|
176
|
+
else if (!isObj(opts))
|
|
177
|
+
opts = {};
|
|
178
|
+
|
|
179
|
+
needObj(obj, (opts.allowFun ?? true));
|
|
180
|
+
|
|
181
|
+
const setprop = opts.df ? df : def;
|
|
182
|
+
const propopts = cp({}, opts.def, opts.df);
|
|
151
183
|
|
|
152
184
|
proppath = nsArray(proppath);
|
|
153
185
|
|
|
154
186
|
let assign;
|
|
155
187
|
if (opts.assign)
|
|
156
188
|
{ // Use direct property assignment.
|
|
157
|
-
assign = (
|
|
189
|
+
assign = (t,p,v) => t[p] = v;
|
|
158
190
|
}
|
|
159
191
|
else if (doesDescriptorTemplate(opts.desc))
|
|
160
192
|
{ // An explicit descriptor.
|
|
161
|
-
assign = (
|
|
193
|
+
assign = (t,p,v) =>
|
|
162
194
|
{
|
|
163
|
-
const desc =
|
|
195
|
+
const desc = cp({}, opts.desc);
|
|
164
196
|
desc.value = v;
|
|
165
|
-
|
|
197
|
+
setprop(t,p,desc,propopts);
|
|
166
198
|
}
|
|
167
199
|
}
|
|
168
200
|
else
|
|
169
201
|
{ // Use def with default descriptor.
|
|
170
|
-
assign = (
|
|
202
|
+
assign = (t,p,v) => setprop(t,p,v,propopts);
|
|
171
203
|
}
|
|
172
204
|
|
|
173
205
|
let cns = obj;
|
|
@@ -183,17 +215,17 @@ function setObjectPath(obj, proppath, opts={})
|
|
|
183
215
|
|
|
184
216
|
if (cns[ns] === undefined)
|
|
185
217
|
{ // Nothing currently here. Let's fix that.
|
|
186
|
-
if (n == lastns &&
|
|
187
|
-
{ //
|
|
218
|
+
if (n == lastns && opts.value !== undefined)
|
|
219
|
+
{ // It's the end of the world as we know it.
|
|
188
220
|
assign(cns, ns, opts.value);
|
|
189
221
|
}
|
|
190
222
|
else
|
|
191
223
|
{ // Create a new empty object.
|
|
192
|
-
assign(cns, ns);
|
|
224
|
+
assign(cns, ns, {});
|
|
193
225
|
}
|
|
194
226
|
}
|
|
195
|
-
else if (opts.overwrite && n == lastns &&
|
|
196
|
-
{ // We have a value, and overwrite mode is on.
|
|
227
|
+
else if (opts.overwrite && n == lastns && opts.value !== undefined)
|
|
228
|
+
{ // We have a defined value, and overwrite mode is on.
|
|
197
229
|
assign(cns, ns, opts.value);
|
|
198
230
|
}
|
|
199
231
|
|
|
@@ -251,11 +283,54 @@ function delObjectPath(obj, proppath, opts={})
|
|
|
251
283
|
|
|
252
284
|
exports.delObjectPath = delObjectPath;
|
|
253
285
|
|
|
286
|
+
/**
|
|
287
|
+
* Build a simple factory object for working with property paths.
|
|
288
|
+
*
|
|
289
|
+
* @param {(object|function)} value - The target object
|
|
290
|
+
* @param {object} [opts] Default options for the *ObjectPath() functions
|
|
291
|
+
* @returns {object} A frozen factory object
|
|
292
|
+
*
|
|
293
|
+
* Has `get(path,opts)`, `set(path,opts)`, and `del(path,opts)` methods,
|
|
294
|
+
* which are wrappers for getObjectPath(), setObjectPath(),
|
|
295
|
+
* and delObjectPath() respectively.
|
|
296
|
+
*
|
|
297
|
+
* Also has `value` and `opts` properties for the arguments.
|
|
298
|
+
*/
|
|
299
|
+
function nsFactory(value, opts={})
|
|
300
|
+
{
|
|
301
|
+
const getOpts = (po) => cp({}, opts, po);
|
|
302
|
+
|
|
303
|
+
const factory =
|
|
304
|
+
{
|
|
305
|
+
value,
|
|
306
|
+
opts,
|
|
307
|
+
get(pp,po)
|
|
308
|
+
{
|
|
309
|
+
return getObjectPath(value, pp, getOpts(po));
|
|
310
|
+
},
|
|
311
|
+
set(pp,po)
|
|
312
|
+
{
|
|
313
|
+
setObjectPath(value, pp, getOpts(po));
|
|
314
|
+
return this;
|
|
315
|
+
},
|
|
316
|
+
del(pp,po)
|
|
317
|
+
{
|
|
318
|
+
delObjectPath(value, pp, getOpts(po));
|
|
319
|
+
return this;
|
|
320
|
+
},
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return Object.freeze(factory);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
exports.nsFactory = nsFactory;
|
|
327
|
+
|
|
254
328
|
/**
|
|
255
329
|
* Get a global namespace path if it exists.
|
|
256
330
|
*
|
|
257
331
|
* This literally just calls `getObjectPath()` on the `root` object.
|
|
258
332
|
*
|
|
333
|
+
* @deprecated
|
|
259
334
|
* @param {(string|Array)} proppath - Property path we're looking for.
|
|
260
335
|
* Generally a string of dot (`.`) separated nested property names.
|
|
261
336
|
* @param {object} [opts] See `getObjectPath()` for details.
|
|
@@ -275,6 +350,7 @@ exports.getNamespace = getNamespace;
|
|
|
275
350
|
*
|
|
276
351
|
* This literally just calls `setObjectPath()` on the `root` object.
|
|
277
352
|
*
|
|
353
|
+
* @deprecated
|
|
278
354
|
* @param {(string|Array)} proppath - Property path to create.
|
|
279
355
|
* @param {object} [opts] See `setObjectPath()` for details.
|
|
280
356
|
* @return {*} See `setObjectPath()` for details.
|
package/lib/objectid.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
const {notNil,def,isNil,F,N,S,SY} = require('./types');
|
|
2
|
+
const {notNil,def,isNil,isObj,F,N,S,SY} = require('./types');
|
|
3
3
|
const argOpts = require('./opt/args');
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -7,12 +7,14 @@ const argOpts = require('./opt/args');
|
|
|
7
7
|
*
|
|
8
8
|
* @param {(object|number)} [opts] Options
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* If this is a number, then it's the `opts.seed` value.
|
|
11
|
+
*
|
|
12
|
+
* @param {number} [opts.seed=0] A base number to use.
|
|
11
13
|
*
|
|
12
14
|
* If this is omitted, or an invalid value (including `0`),
|
|
13
|
-
* the default is to use `Date.now()` as
|
|
15
|
+
* the default is to use `Date.now()` as `opts.seed`.
|
|
14
16
|
*
|
|
15
|
-
* @param {number} [mode=1] Determine how to handle return value
|
|
17
|
+
* @param {number} [opts.mode=1] Determine how to handle return value
|
|
16
18
|
*
|
|
17
19
|
* | Mode | Description |
|
|
18
20
|
* | ------- | --------------------------------------------------------- |
|
|
@@ -21,12 +23,16 @@ const argOpts = require('./opt/args');
|
|
|
21
23
|
* | `2` | `Math.floor()` |
|
|
22
24
|
* | `3` | `Math.ceil()` |
|
|
23
25
|
*
|
|
26
|
+
* @param {number} [mode=1] Positional version of `opts.mode`.
|
|
27
|
+
*
|
|
24
28
|
* @returns {number}
|
|
25
29
|
* @alias module:@lumjs/core.randomNumber
|
|
26
30
|
*/
|
|
27
31
|
function randomNumber(seed=0, mode=1)
|
|
28
32
|
{
|
|
29
|
-
|
|
33
|
+
const opts = argOpts({seed, mode}, 'seed', 0);
|
|
34
|
+
if (typeof opts.seed !== N || opts.seed === 0)
|
|
35
|
+
opts.seed = Date.now();
|
|
30
36
|
|
|
31
37
|
const rand = Math.random() * seed;
|
|
32
38
|
|
|
@@ -56,18 +62,42 @@ class UniqueObjectIds
|
|
|
56
62
|
{
|
|
57
63
|
def(this, '$options', {value: opts});
|
|
58
64
|
|
|
59
|
-
|
|
65
|
+
let radix = null;
|
|
66
|
+
|
|
67
|
+
if (isObj(opts.random))
|
|
68
|
+
{ // Random ids with custom options.
|
|
69
|
+
def(this, '$randOpts', {value: opts.random});
|
|
70
|
+
if (validBase(opts.random.radix))
|
|
71
|
+
{
|
|
72
|
+
radix = opts.random.radix;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else if (validBase(opts.random))
|
|
60
76
|
{ // Use random ids.
|
|
61
|
-
def(this, '$
|
|
77
|
+
def(this, '$randOpts', {value: {}});
|
|
78
|
+
radix = opts.random;
|
|
62
79
|
}
|
|
63
80
|
else if (validBase(opts.timestamp))
|
|
64
81
|
{ // Use timestamp-based ids.
|
|
65
82
|
def(this, '$timeIds', {value: {}});
|
|
83
|
+
radix = opts.timestamp;
|
|
66
84
|
}
|
|
67
85
|
else
|
|
68
86
|
{ // Use incremental ids.
|
|
69
87
|
def(this, '$incIds', {value: {}});
|
|
70
88
|
}
|
|
89
|
+
|
|
90
|
+
if (!radix)
|
|
91
|
+
{
|
|
92
|
+
radix = validBase(opts.radix) ? opts.radix : 16;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
def(this, '$radix', radix);
|
|
96
|
+
|
|
97
|
+
if (this.$randOpts)
|
|
98
|
+
{
|
|
99
|
+
def(this, '$randIds', {value: {}});
|
|
100
|
+
}
|
|
71
101
|
|
|
72
102
|
const propType = (typeof opts.idProperty);
|
|
73
103
|
const hasProp = (propType === S || propType === SY);
|
|
@@ -104,6 +134,8 @@ class UniqueObjectIds
|
|
|
104
134
|
return obj[idProp];
|
|
105
135
|
}
|
|
106
136
|
|
|
137
|
+
let radix = this.$radix;
|
|
138
|
+
|
|
107
139
|
let cno = this.$options.className ?? {};
|
|
108
140
|
if (typeof cno === F) cno = {setup: cno};
|
|
109
141
|
else if (cno === 'lc') cno = {lowercase: true};
|
|
@@ -116,7 +148,7 @@ class UniqueObjectIds
|
|
|
116
148
|
id += this.$options.prefix;
|
|
117
149
|
}
|
|
118
150
|
|
|
119
|
-
let className = obj.constructor.name;
|
|
151
|
+
let className = (typeof obj === F ? obj : obj.constructor).name;
|
|
120
152
|
|
|
121
153
|
if (typeof cno.setup === F)
|
|
122
154
|
{ // Perform a transformation before any other changes.
|
|
@@ -139,7 +171,7 @@ class UniqueObjectIds
|
|
|
139
171
|
const ids = this.$incIds;
|
|
140
172
|
if (ids[className])
|
|
141
173
|
{ // An existing value was found.
|
|
142
|
-
idNum = (++ids[className]).toString();
|
|
174
|
+
idNum = (++ids[className]).toString(radix);
|
|
143
175
|
}
|
|
144
176
|
else
|
|
145
177
|
{ // No existing values yet.
|
|
@@ -153,16 +185,14 @@ class UniqueObjectIds
|
|
|
153
185
|
}
|
|
154
186
|
else
|
|
155
187
|
{ // Something other than auto-increment.
|
|
156
|
-
let ids
|
|
188
|
+
let ids;
|
|
157
189
|
if (this.$randIds)
|
|
158
190
|
{ // Using a random id.
|
|
159
191
|
ids = this.$randIds;
|
|
160
|
-
radix = this.$options.random;
|
|
161
192
|
}
|
|
162
193
|
else if (this.$timeIds)
|
|
163
194
|
{ // Using timestamp ids.
|
|
164
195
|
ids = this.$timeIds;
|
|
165
|
-
radix = this.$options.timestamp;
|
|
166
196
|
}
|
|
167
197
|
else
|
|
168
198
|
{ // Something went horribly wrong.
|
|
@@ -170,7 +200,7 @@ class UniqueObjectIds
|
|
|
170
200
|
}
|
|
171
201
|
|
|
172
202
|
const getId = () => (this.$randIds
|
|
173
|
-
? randomNumber()
|
|
203
|
+
? randomNumber(this.$randOpts)
|
|
174
204
|
: Date.now())
|
|
175
205
|
.toString(radix);
|
|
176
206
|
|
package/lib/observable.js
CHANGED
package/lib/types/basics.js
CHANGED
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
const JS = require('./js');
|
|
18
18
|
const {O, F, S, SY} = JS;
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* The _abstract prototype_ of all typed arrays.
|
|
22
|
+
* This is part of every modern JS runtime, but is not directly accessible.
|
|
23
|
+
* @alias module:@lumjs/core/types/basics.TypedArray
|
|
24
|
+
*/
|
|
25
|
+
const TypedArray = Object.getPrototypeOf(Int8Array);
|
|
26
|
+
|
|
20
27
|
/**
|
|
21
28
|
* See if a value is a non-null `object`.
|
|
22
29
|
* @param {*} v - The value we're testing.
|
|
@@ -78,7 +85,7 @@ const isArray = Array.isArray;
|
|
|
78
85
|
*/
|
|
79
86
|
function isTypedArray(v)
|
|
80
87
|
{
|
|
81
|
-
return (
|
|
88
|
+
return (v instanceof TypedArray);
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
/**
|
|
@@ -147,6 +154,10 @@ function isIterable(v)
|
|
|
147
154
|
* For the purposes of this test, a class constructor is
|
|
148
155
|
* any Function that has a `prototype` Object property.
|
|
149
156
|
*
|
|
157
|
+
* NOTE: almost every function has a prototype property,
|
|
158
|
+
* only Closures and some built-in methods don't.
|
|
159
|
+
* So this is not a foolproof method by any stretch.
|
|
160
|
+
*
|
|
150
161
|
* @param {*} v - Value to test
|
|
151
162
|
* @returns {boolean}
|
|
152
163
|
* @alias module:@lumjs/core/types/basics.isConstructor
|
|
@@ -185,6 +196,20 @@ function isClassObject(v)
|
|
|
185
196
|
return (isObj(v) && typeof v.constructor === F && v.constructor !== Object);
|
|
186
197
|
}
|
|
187
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Is a value an object with a null prototype?
|
|
201
|
+
*
|
|
202
|
+
* An object with a null prototype won't have any of the usual
|
|
203
|
+
* meta-programming methods or properties from `Object.prototype`.
|
|
204
|
+
*
|
|
205
|
+
* @param {*} v - Value to test
|
|
206
|
+
* @returns {boolean}
|
|
207
|
+
*/
|
|
208
|
+
function isDiscreteObject(v)
|
|
209
|
+
{
|
|
210
|
+
return (isObj(v) && Object.getPrototypeOf(v) === null);
|
|
211
|
+
}
|
|
212
|
+
|
|
188
213
|
/**
|
|
189
214
|
* See if an object can be used as a valid *descriptor*.
|
|
190
215
|
*
|
|
@@ -278,8 +303,9 @@ module.exports =
|
|
|
278
303
|
{
|
|
279
304
|
isObj, isComplex, isNil, notNil, isScalar, isArray, isTypedArray,
|
|
280
305
|
isIterable, nonEmptyArray, isArguments, isProperty, isConstructor,
|
|
281
|
-
isPlainObject, isClassObject,
|
|
282
|
-
|
|
306
|
+
isPlainObject, isClassObject, isDiscreteObject,
|
|
307
|
+
doesDescriptor, doesDescriptorTemplate,
|
|
308
|
+
JS, TypedArray,
|
|
283
309
|
}
|
|
284
310
|
|
|
285
311
|
JS.addTo(module.exports);
|
package/lib/types/def.js
CHANGED
|
@@ -11,7 +11,7 @@ const clone = (...args) => Object.assign({}, ...args);
|
|
|
11
11
|
* It's gotten almost as convoluted as the old prop() method it replaced
|
|
12
12
|
* from my original Nano.js libraries.
|
|
13
13
|
*
|
|
14
|
-
* I have written new `obj.{df,dfa,
|
|
14
|
+
* I have written new `obj.{df,dfa,dfor}` functions that will replace this
|
|
15
15
|
* function going forward. The related `types.lazy()` function will also
|
|
16
16
|
* be refactored to use the new functions, and moved to the `obj` module.
|
|
17
17
|
*
|
|
@@ -248,3 +248,6 @@ module.exports = def;
|
|
|
248
248
|
const DT = require('./dt');
|
|
249
249
|
DT.addInit(def);
|
|
250
250
|
def.DT = DT;
|
|
251
|
+
|
|
252
|
+
// And a reference to the old lazy
|
|
253
|
+
def(def, 'lazy', {get: () => require('./lazy')});
|
package/lib/types/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @module @lumjs/core/types
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const def = require('./def')
|
|
12
|
+
const def = require('./def');
|
|
13
13
|
|
|
14
14
|
// Compose in sub-modules.
|
|
15
15
|
Object.assign(exports,
|
|
@@ -19,7 +19,7 @@ Object.assign(exports,
|
|
|
19
19
|
require('./stringify'),
|
|
20
20
|
require('./needs'),
|
|
21
21
|
{ // A few standalone exports.
|
|
22
|
-
def,
|
|
22
|
+
def,
|
|
23
23
|
TYPES: require('./typelist'),
|
|
24
24
|
ownCount: require('./owncount'),
|
|
25
25
|
},
|
|
@@ -42,3 +42,11 @@ def(exports.TYPES, '$module', module);
|
|
|
42
42
|
|
|
43
43
|
// Extend `unbound` with add() and remove() methods.
|
|
44
44
|
require('./unbound/extend')(exports.unbound);
|
|
45
|
+
|
|
46
|
+
// Deprecated alias for `lazy` function.
|
|
47
|
+
wrapDepr(exports, 'lazy',
|
|
48
|
+
{
|
|
49
|
+
dep: 'core.types.lazy',
|
|
50
|
+
rep: 'core.obj.lazy',
|
|
51
|
+
get: () => require('../obj/df').lazy,
|
|
52
|
+
});
|
package/lib/types/isa.js
CHANGED
|
@@ -398,7 +398,7 @@ class OfTest
|
|
|
398
398
|
*
|
|
399
399
|
* This will be used to set the value of the `this.valid` property.
|
|
400
400
|
*
|
|
401
|
-
* @param {object}
|
|
401
|
+
* @param {object} rulesets - Object to set as the `this.rules` property.
|
|
402
402
|
*
|
|
403
403
|
* If `valid(rules)` returns `true` then the `rules` will be
|
|
404
404
|
* changed to `{value: rules}`. This is a short-cut so that
|
|
@@ -409,7 +409,7 @@ class OfTest
|
|
|
409
409
|
*
|
|
410
410
|
* See the class property description for the supported optional values.
|
|
411
411
|
*
|
|
412
|
-
* @param {object}
|
|
412
|
+
* @param {object} rulesets.value - The container being tested.
|
|
413
413
|
*
|
|
414
414
|
* @param {?Array} valueTypes - An array of type tests for the values.
|
|
415
415
|
*
|
|
@@ -839,7 +839,7 @@ const isntRules = v => (isObj(v) && !(v instanceof OfTestRules));
|
|
|
839
839
|
* test function that will return an instance of the `OfTest.Rules` class,
|
|
840
840
|
* passing all parameters along to the constructor.
|
|
841
841
|
*
|
|
842
|
-
* @param {object}
|
|
842
|
+
* @param {object} rulesets - Rules for this test function.
|
|
843
843
|
*
|
|
844
844
|
* If this argument is anything other than a `OfTest.Rules` instance,
|
|
845
845
|
* it is assumed to be the `rules.value` named option.
|
|
@@ -852,7 +852,7 @@ const isntRules = v => (isObj(v) && !(v instanceof OfTestRules));
|
|
|
852
852
|
* const isValid = isObjOf(isObjOf.rules(value, opts), type1, type2, ...);
|
|
853
853
|
* ```
|
|
854
854
|
*
|
|
855
|
-
* @param {Iterable}
|
|
855
|
+
* @param {Iterable} rulesets.value - The actual list object for the tests.
|
|
856
856
|
*
|
|
857
857
|
* @param {...any} types - See {@link module:@lumjs/core/types.isa}.
|
|
858
858
|
*
|