@lumjs/core 1.0.0-beta.1 → 1.0.0-beta.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 (45) hide show
  1. package/README.md +10 -2
  2. package/TODO.md +12 -4
  3. package/docs/changelogs/1.0-beta.md +99 -0
  4. package/{CHANGELOG.md → docs/changelogs/1.x.md} +7 -7
  5. package/jsdoc.json +33 -0
  6. package/lib/arrays.js +78 -0
  7. package/lib/context.js +86 -0
  8. package/{src → lib}/enum.js +30 -13
  9. package/{src → lib}/flags.js +6 -0
  10. package/lib/index.js +131 -0
  11. package/{src → lib}/lazy.js +33 -35
  12. package/{src → lib}/meta.js +38 -1
  13. package/lib/modules.js +113 -0
  14. package/lib/obj/clone.js +220 -0
  15. package/{src → lib}/obj/copyall.js +3 -0
  16. package/{src → lib}/obj/copyprops.js +1 -0
  17. package/lib/obj/index.js +23 -0
  18. package/{src → lib}/obj/lock.js +16 -13
  19. package/{src → lib}/obj/merge.js +2 -0
  20. package/{src → lib}/obj/ns.js +45 -8
  21. package/{src → lib}/objectid.js +2 -3
  22. package/{src → lib}/observable.js +23 -8
  23. package/{src → lib}/opt.js +6 -1
  24. package/lib/strings.js +192 -0
  25. package/lib/types/basics.js +154 -0
  26. package/lib/types/def.js +183 -0
  27. package/lib/types/index.js +55 -0
  28. package/lib/types/isa.js +186 -0
  29. package/lib/types/js.js +12 -0
  30. package/lib/types/needs.js +117 -0
  31. package/lib/types/root.js +92 -0
  32. package/lib/types/stringify.js +98 -0
  33. package/lib/types/typelist.js +168 -0
  34. package/package.json +26 -3
  35. package/test/arrays.js +19 -0
  36. package/test/meta.js +17 -0
  37. package/test/types.js +106 -23
  38. package/index.js +0 -64
  39. package/src/context.js +0 -47
  40. package/src/descriptors.js +0 -243
  41. package/src/obj/clone.js +0 -201
  42. package/src/obj/index.js +0 -18
  43. package/src/prop.js +0 -170
  44. package/src/strings.js +0 -76
  45. package/src/types.js +0 -545
package/README.md CHANGED
@@ -6,9 +6,17 @@ and work in CommonJS/Node.js and modern browsers without any modifications.
6
6
 
7
7
  Used by all the rest of my *Lum.js* libraries.
8
8
 
9
- ## Exports
9
+ ## Documentation
10
10
 
11
- TODO: a brief summary of the exports.
11
+ ### [API Docs](https://supernovus.github.io/docs/js/@lumjs/core/)
12
+
13
+ The documentation is written in [JSDoc 3](https://jsdoc.app/) format.
14
+
15
+ You can compile the documentation using `npm run build-docs`
16
+ which will put the generated docs into the `./docs/api` folder.
17
+
18
+ ### [Changelog](./docs/changelogs/1.0-beta.md)
19
+ ### [TODO](TODO.md)
12
20
 
13
21
  ## Official URLs
14
22
 
package/TODO.md CHANGED
@@ -1,23 +1,31 @@
1
1
  # TODO
2
2
 
3
3
  - Proper tests using new [@lumjs/tests](https://github.com/supernovus/lum.tests.js) library.
4
- - [x] `types`
4
+ - [x] `types/js`
5
+ - [x] `types/basics`
6
+ - [x] `types/root`
7
+ - [x] `types/isa`
8
+ - [x] `types/needs`
9
+ - [x] `types/def`
10
+ - [x] `types/typelist`
11
+ - [ ] `types/stringify`
12
+ - [x] `types/index`
13
+ - [x] `arrays`
5
14
  - [ ] `context`
6
15
  - [ ] `strings`
7
16
  - [ ] `flags`
8
- - [ ] `descriptors`
9
17
  - [ ] `obj/copyall`
10
18
  - [ ] `obj/copyprops`
11
19
  - [ ] `obj/clone`
12
20
  - [ ] `obj/lock`
13
21
  - [ ] `obj/merge`
14
22
  - [ ] `obj/ns`
23
+ - [ ] `obj/index`
15
24
  - [ ] `opt`
16
25
  - [ ] `objectid`
17
26
  - [ ] `meta`
18
27
  - [ ] `enum`
19
- - [ ] `prop`
20
28
  - [ ] `lazy`
21
29
  - [ ] `observable`
22
- - Anything that has a TODO notice in the code.
30
+ - [ ] `index`
23
31
 
@@ -0,0 +1,99 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## Note
8
+
9
+ This is the *Changelog* for the `1.0.0-beta.x` releases.
10
+ See [1.x.md](1.x.md) for the stable `1.x` *Changelog*.
11
+
12
+ ## [1.0.0-beta.6]
13
+ - This is the **final** beta version.
14
+ - Version `1.0.0` will be this but with the docs updated a bit.
15
+ ### Added
16
+ - More tests for the `types` module.
17
+ - Changelog file for the upcoming `1.x` *stable* releases.
18
+ ### Changed
19
+ - Removed some convoluted options from `def()`.
20
+ - Reworked `types.stringify()` to handle recursive mode better.
21
+ - Added `Error` stringification to `types.stringify()`
22
+
23
+ ## [1.0.0-beta.5] - 2022-07-18
24
+ ### Added
25
+ - A new `types.stringify()` method.
26
+ - Shortcut `string` options for the `types.def()` method.
27
+ - A `build-docs` script in `package.json`.
28
+ ### Changed
29
+ - Overhauled all DocBlocks to conform to `JSDoc 3` format.
30
+ - Changed `context.has` to support a magic `Proxy` version.
31
+ - Some tweaks to `Enum` to cleanup some things.
32
+ - Both `Enum` and `observable` use `TYPES.add()` now.
33
+ - In `modules.name()` nixed `opts.noAuto` and added `opts.useAuto` instead.
34
+ - Created explicit `exports` definition in `package.json` with our sub-modules.
35
+ ### Fixed
36
+ - Fixed a property definition issue in `obj.SOA()`.
37
+
38
+ ## [1.0.0-beta.4] - 2022-07-15
39
+ ### Added
40
+ - Two new clone modes:
41
+ - `CLONE.DEEP` : A recursive clone of enumerable properties.
42
+ - `CLONE.ENTIRE` : A recursive clone of all properties.
43
+ - Added `types.isa()` which wraps `isType()` and `isInstance()` along with some added magic that makes it a generic *smart match* function.
44
+ - Added `types.needs()` which does for `isa()` what `needOb()` and `needType()` do for `isObj()` and `isType()` respectively.
45
+ - A `jsdoc.json` based on the one from the old [Lum.js](https://github.com/supernovus/lum.js) codebase.
46
+ - A temporary `test` script to the `package.json` which uses the `prove` utility from Perl 5.
47
+ ### Removed
48
+ - Removed `descriptors` and `prop()` modules.
49
+ - They'll be in a new `@lumjs/compat` library for legacy compatibility code.
50
+ ### Changed
51
+ - Updated this *changelog* which I forgot to do last time.
52
+ - Fixed some formatting in the changelog.
53
+ - Split `types` into separated files.
54
+ - Moved/renamed a few functions:
55
+ - `types.containsAny()` → `arrays.containsAny()`
56
+ - `types.containsAll()` → `arrays.containsAll()`
57
+ - `types.removeFromArray()` → `arrays.removeItems()`
58
+ - `types.NYI()` → `meta.NYI()`
59
+ - Updated tests to reflect the moved/renamed functions.
60
+ - Enhanced `def()` function as it has fully replaced `prop()` now.
61
+ - Has a new `opts` parameter which can be used for a few different options.
62
+ - Allows assigning a *getter* and *setter* without using a descriptor.
63
+ - Updated `lazy()` to be an extension of `def()` instead of `prop()`.
64
+ - Updated `obj/clone` and `obj/lock` to remove use of `descriptors` magic.
65
+ - Updated `CLONE` mode documentation to use a table format.
66
+ - A few minor tweaks and cleanups related to the rest of the above changes.
67
+ - Updated [../../TODO.md](TODO.md) with the plans for the final `1.0.0` release.
68
+
69
+ ## [1.0.0-beta.3] - 2022-07-11
70
+ ### Added
71
+ - `core.context.hasRequire`: A boolean value indicating `require()`
72
+ - `core.context.isNode`: A boolean value guessing the environment is node.js
73
+ ### Changed
74
+ - `core.context.CJS`: Made slightly tighter in definition.
75
+ - `core.modules.name()`: Made it more flexible.
76
+ - `core.obj`: Changed namespace exports.
77
+ ### Fixed
78
+ - `core.modules.name()`: Actually return the value!
79
+
80
+ ## [1.0.0-beta.2] - 2022-07-08
81
+ ### Changed
82
+ - Renamed `src` to `lib` as we're not compiling/transpiling this code.
83
+ - Moved `index.js` into `lib` with the rest of the module files.
84
+ - Added `modules.js` with a method for generating a name/id for a module.
85
+ - Added `isSearch()`,`isReplacement()`, and `replaceItems()` to `strings.js`.
86
+
87
+ ## [1.0.0-beta.1] - 2022-07-07
88
+ ### Added
89
+ - Initial release.
90
+ - Pulled a bunch of the core libraries from the old Lum.js project.
91
+ - Refactored and reorganized the libraries a lot.
92
+
93
+ [1.0.0-beta.6]: https://github.com/supernovus/lum.core.js/compare/v1.0.0-beta.5...v1.0.0-beta.6
94
+ [1.0.0-beta.5]: https://github.com/supernovus/lum.core.js/compare/v1.0.0-beta.4...v1.0.0-beta.5
95
+ [1.0.0-beta.4]: https://github.com/supernovus/lum.core.js/compare/v1.0.0-beta.3...v1.0.0-beta.4
96
+ [1.0.0-beta.3]: https://github.com/supernovus/lum.core.js/compare/v1.0.0-beta.2...v1.0.0-beta.3
97
+ [1.0.0-beta.2]: https://github.com/supernovus/lum.core.js/compare/v1.0.0-beta.1...v1.0.0-beta.2
98
+ [1.0.0-beta.1]: https://github.com/supernovus/lum.core.js/releases/tag/v1.0.0-beta.1
99
+
@@ -6,12 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## [1.0.0-beta.1] - 2022-07-07
10
- ### Added
11
- - Initial release.
12
- - Pulled a bunch of the core libraries from the old Lum.js project.
13
- - Refactored and reorganized the libraries a lot.
9
+ ## [1.0.0] - 2022-07-27
10
+ ### Changed
11
+ - Initial *stable* release.
12
+ - See [1.0-beta.md](1.0-beta.md) for the beta versions of `1.0`
13
+ - See [lum.js](https://github.com/supernovus/lum.js) for the original library this is replacing.
14
14
 
15
- [Unreleased]: https://github.com/supernovus/lum.core.js/compare/v1.0.0-beta.1...HEAD
16
- [1.0.0-beta.1]: https://github.com/supernovus/lum.core.js/releases/tag/v1.0.0-beta.1
15
+ [Unreleased]: https://github.com/supernovus/lum.core.js/compare/v1.0.0...HEAD
16
+ [1.0.0]: https://github.com/supernovus/lum.core.js/releases/tag/v1.0.0
17
17
 
package/jsdoc.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "tags":
3
+ {
4
+ "allowUnknownTags": true
5
+ },
6
+ "source":
7
+ {
8
+ "include": ["./lib"]
9
+ },
10
+ "opts":
11
+ {
12
+ "destination": "./docs/api",
13
+ "recurse": true
14
+ },
15
+ "plugins":
16
+ [
17
+ "plugins/markdown"
18
+ ],
19
+ "templates":
20
+ {
21
+ "cleverLinks": false,
22
+ "monospaceLinks": false,
23
+ "default":
24
+ {
25
+ "outputSourceFiles": true
26
+ },
27
+ "path": "ink-docstrap",
28
+ "theme": "cerulean",
29
+ "navType": "vertical",
30
+ "linenums": true,
31
+ "dateFormat": "YYYY-MM-DD, hh:mm:ss"
32
+ }
33
+ }
package/lib/arrays.js ADDED
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Array helper functions.
3
+ * @module module:@lumjs/core/arrays
4
+ */
5
+
6
+ /**
7
+ * See if an array contains *any* of the specified items.
8
+ * @param {Array} array
9
+ * @param {...any} items
10
+ * @returns {boolean}
11
+ * @alias module:@lumjs/core/arrays.containsAny
12
+ */
13
+ function containsAny(array, ...items)
14
+ {
15
+ for (const item of items)
16
+ {
17
+ if (array.includes(item))
18
+ { // Item found.
19
+ return true;
20
+ }
21
+ }
22
+
23
+ // No items found.
24
+ return false;
25
+ }
26
+
27
+ exports.containsAny = containsAny;
28
+
29
+ /**
30
+ * See if an array contains *all* of the specified items.
31
+ * @param {Array} array
32
+ * @param {...any} items
33
+ * @returns {boolean}
34
+ * @alias module:@lumjs/core/arrays.containsAll
35
+ */
36
+ function containsAll(array, ...items)
37
+ {
38
+ for (const item of items)
39
+ {
40
+ if (!array.includes(item))
41
+ { // An item was missing.
42
+ return false;
43
+ }
44
+ }
45
+
46
+ // All items found.
47
+ return true;
48
+ }
49
+
50
+ exports.containsAll = containsAll;
51
+
52
+ /**
53
+ * Remove items from an array.
54
+ *
55
+ * Passed any number of items, it will see if any of those items are
56
+ * found in the array, and if they are, will remove them from the array.
57
+ *
58
+ * @param {Array} array
59
+ * @param {...any} items
60
+ * @returns {number} Number of items actually removed.
61
+ * @alias module:@lumjs/core/arrays.removeItems
62
+ */
63
+ function removeItems(array, ...items)
64
+ {
65
+ let removed = 0;
66
+ for (const item of items)
67
+ {
68
+ const index = array.indexOf(item);
69
+ if (index !== -1)
70
+ {
71
+ array.splice(index, 1);
72
+ removed++;
73
+ }
74
+ }
75
+ return removed;
76
+ }
77
+
78
+ exports.removeItems = removeItems;
package/lib/context.js ADDED
@@ -0,0 +1,86 @@
1
+
2
+ /**
3
+ * Context sub-module
4
+ *
5
+ * Used as a static object that has a bunch of properties
6
+ * describing the current JS environment and execution context.
7
+ *
8
+ * @module @lumjs/core/context
9
+ * @property {boolean} AMD - AMD (*RequireJS*) module loading detected.
10
+ * @property {boolean} CJS - CommonJS environment detected.
11
+ * @property {boolean} hasRequire - A global `require()` function was found.
12
+ * @property {boolean} hasExports - A global `exports` object was found.
13
+ * @property {boolean} hasModule - A global `module` object was found.
14
+ * @property {boolean} isNode - Is likely *Node.js*, *Electron*, etc.
15
+ * @property {boolean} isBrowser - A web-browser environment detected.
16
+ * @property {boolean} isWindow - Is a browser `Window` context.
17
+ * @property {boolean} isWorker - Is a browser `Worker` (sub-types below.)
18
+ * @property {boolean} isServiceWorker - Is a `ServiceWorker` context.
19
+ * @property {boolean} isDedicatedWorker - Is a `DedicatedWorker` context.
20
+ * @property {boolean} isSharedWorker - Is a `SharedWorker` context.
21
+ * @property {object} root - See {@link module:@lumjs/core/types.root}
22
+ */
23
+
24
+ const {root,B,F,U,O,isComplex,def} = require('./types');
25
+
26
+ const ctx = {root};
27
+
28
+ const rootHas = what => typeof root[what] !== U;
29
+ const cd = def(ctx, true);
30
+
31
+ cd('AMD', typeof define === F && define.amd)
32
+ ('hasRequire', typeof require === F)
33
+ ('hasExports', typeof exports !== U)
34
+ ('hasModule', typeof module === O && module !== null)
35
+ ('CJS', ctx.hasRequire && ctx.hasModule && isComplex(module.exports))
36
+ ('isNode', ctx.CJS && ctx.hasExports)
37
+ ('isWindow', !ctx.CJS && rootHas('window'))
38
+ ('isWorker', !ctx.CJS && rootHas('WorkerGlobalScope'))
39
+ ('isServiceWorker', !ctx.CJS && rootHas('ServiceWorkerGlobalScope'))
40
+ ('isDedicatedWorker', !ctx.CJS && rootHas('DedicatedWorkerGlobalScope'))
41
+ ('isSharedWorker', !ctx.CJS && rootHas('SharedWorkerGlobalScope'))
42
+ ('isBrowser', ctx.isWindow || ctx.isWorker);
43
+
44
+ /**
45
+ * See if a root-level name is defined.
46
+ *
47
+ * This adds a `context.has.{name}` boolean property which caches the
48
+ * result so it can be referred to directly.
49
+ *
50
+ * In any JS environment with the `Proxy` object (which honestly should
51
+ * be all modern ones), you can simple do `context.has.SomeObject` instead
52
+ * of `context.has('SomeObject')` and it will do the Right Thing™.
53
+ *
54
+ * @param {string} ns - The global function/class/object we're looking for.
55
+ * @returns {boolean} If that global name is defined or not.
56
+ * @alias module:@lumjs/core/context.has
57
+ */
58
+ function hasRoot(ns)
59
+ {
60
+ if (typeof hasRoot[ns] === B) return hasRoot[ns];
61
+ const result = rootHas(ns);
62
+ def(hasRoot, ns, {value: result, enumerable: true});
63
+ return result;
64
+ }
65
+
66
+ // Build some common has items.
67
+ for (const what of ['Proxy','Promise','Reflect','fetch'])
68
+ {
69
+ hasRoot(what);
70
+ }
71
+
72
+ if (hasRoot.Proxy)
73
+ { // Make a Proxy-wrapped version of `context.has`
74
+ cd('has', new Proxy(hasRoot,
75
+ {
76
+ get(t, p) { return (typeof t[p] !== U) ? t[p] : t(p) }
77
+ }));
78
+ // And include the unwrapped version for good measure.
79
+ cd('$has', hasRoot);
80
+ }
81
+ else
82
+ { // No Proxy support, just directly assign `context.has()`
83
+ cd('has', hasRoot);
84
+ }
85
+
86
+ module.exports = ctx;
@@ -1,7 +1,7 @@
1
-
2
- const {S,def,notNil,isObj} = require('./types')
1
+ const {S,def,notNil,isObj,needObj,TYPES} = require('./types');
3
2
  const {InternalObjectId} = require('./objectid');
4
3
 
4
+ // Internal id instances should never be exported.
5
5
  const ENUM_ID = new InternalObjectId({name: '$Enum'});
6
6
 
7
7
  /**
@@ -12,17 +12,12 @@ const ENUM_ID = new InternalObjectId({name: '$Enum'});
12
12
  * @param {*} spec - TBD
13
13
  * @param {*} [opts] - TBD
14
14
  * @returns {object} A magic Enum object.
15
+ * @exports module:@lumjs/core/enum
15
16
  */
16
17
  function Enum (spec, opts={})
17
18
  {
18
- if (!isObj(spec))
19
- {
20
- throw new TypeError("Enum spec must be an object");
21
- }
22
- if (!isObj(opts))
23
- {
24
- throw new TypeError("Enum options must be an object")
25
- }
19
+ needObj(spec, "Enum spec must be an object")
20
+ needObj(opts, "Enum options must be an object")
26
21
 
27
22
  const anEnum = ENUM_ID.tag({});
28
23
 
@@ -61,7 +56,7 @@ function Enum (spec, opts={})
61
56
  const name = spec[i];
62
57
  if (typeof name !== S)
63
58
  {
64
- throw new TypeError("Non-string passed in Lum.Enum object");
59
+ throw new TypeError("Non-string passed in Enum object");
65
60
  }
66
61
 
67
62
  const val
@@ -117,7 +112,29 @@ function Enum (spec, opts={})
117
112
 
118
113
  } // Enum
119
114
 
120
- // Add an 'is' method.
121
- def(Enum, 'is', ENUM_ID.isFunction());
115
+ /**
116
+ * Is a value an *Enum* magic object?
117
+ * @function module:@lumjs/core/enum.is
118
+ * @param {*} obj - The expected object/function to test.
119
+ * @returns {boolean}
120
+ */
121
+ const isEnum = ENUM_ID.isFunction()
122
+ def(Enum, 'is', isEnum);
123
+
124
+ /**
125
+ * Is a value an *Enum* magic object?
126
+ * @name module:@lumjs/core/types.isEnum
127
+ * @function
128
+ * @param {*} v - The value to test.
129
+ * @returns {boolean}
130
+ * @see module:@lumjs/core/enum.is
131
+ */
132
+
133
+ /**
134
+ * Extension type for {@link module:@lumjs/core/enum} magic objeccts.
135
+ * @memberof module:@lumjs/core/types.TYPES
136
+ * @member {string} ENUM - Is an Enum object?
137
+ */
138
+ TYPES.add('ENUM', 'enum', isEnum, 'isEnum');
122
139
 
123
140
  module.exports = Enum;
@@ -1,4 +1,8 @@
1
1
 
2
+ /**
3
+ * Helper functions for working with binary flags.
4
+ * @module @lumjs/core/flags
5
+ */
2
6
  const {N} = require('./types');
3
7
 
4
8
  /**
@@ -7,6 +11,7 @@ const {N} = require('./types');
7
11
  * @param {number} flag - An integer representing the flag to add or remove.
8
12
  * @param {boolean} [value=true] `true` means add, `false` means remove.
9
13
  * @returns {number} The `flags` with the `flag` added or removed accordingly.
14
+ * @alias module:@lumjs/core/flags.setFlag
10
15
  */
11
16
  function setFlag(flags, flag, value=true)
12
17
  {
@@ -27,6 +32,7 @@ exports.setFlag = setFlag;
27
32
  * Combine an entire set of flags into a single set.
28
33
  * @param {...number} flag - Any number of flags you want to add.
29
34
  * @returns {number} All the passed flags combined into one set.
35
+ * @alias module:@lumjs/core/flags.allFlags
30
36
  */
31
37
  function allFlags()
32
38
  {
package/lib/index.js ADDED
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Core Library
3
+ *
4
+ * This is the foundation upon which all the rest of my JS libraries
5
+ * are built. It provides fundamental helper functions and classes.
6
+ *
7
+ * @module @lumjs/core
8
+ */
9
+
10
+ /**
11
+ * Constants and functions for basic type checking.
12
+ * @alias module:@lumjs/core.types
13
+ * @see module:@lumjs/core/types
14
+ */
15
+ const types = require('./types');
16
+
17
+ /**
18
+ * Array utility functions.
19
+ * @alias module:@lumjs/core.arrays
20
+ * @see module:@lumjs/core/arrays
21
+ */
22
+ const arrays = require('./arrays');
23
+
24
+ /**
25
+ * Information about the JS context we're running in.
26
+ * @alias module:@lumjs/core.context
27
+ * @see module:@lumjs/core/context
28
+ */
29
+ const context = require('./context');
30
+
31
+ /**
32
+ * Functions for working with strings and locales.
33
+ * @alias module:@lumjs/core.strings
34
+ * @see module:@lumjs/core/strings
35
+ */
36
+ const strings = require('./strings');
37
+
38
+ /**
39
+ * Functions for working with binary flags.
40
+ * @alias module:@lumjs/core.flags
41
+ * @see module:@lumjs/core/flags
42
+ */
43
+ const flags = require('./flags');
44
+
45
+ /**
46
+ * Functions for manipulating objects.
47
+ * @alis module:@lumjs/core.obj
48
+ * @see module:@lumjs/core/obj
49
+ */
50
+ const obj = require('./obj');
51
+
52
+ /**
53
+ * Functions for getting values and properties with fallback defaults.
54
+ * @alias module:@lumjs/core.opt
55
+ * @see module:@lumjs/core/opt
56
+ */
57
+ const opt = require('./opt');
58
+
59
+ /**
60
+ * Meta functions related to JS modules.
61
+ * @alias module:@lumjs/core.modules
62
+ * @see module:@lumjs/core/modules
63
+ */
64
+ const modules = require('./modules');
65
+
66
+ // ObjectID stuff is imported directly without registering a sub-module.
67
+ const {randomNumber, InternalObjectId} = require('./objectid');
68
+
69
+ /**
70
+ * Get a simplistic debugging stacktrace.
71
+ * @name module:@lumjs/core.stacktrace
72
+ * @function
73
+ * @see module:@lumjs/core/meta.stacktrace
74
+ */
75
+
76
+ /**
77
+ * A simple base class for making *abstract* classes.
78
+ * @name module:@lumjs/core.AbstractClass
79
+ * @see module:@lumjs/core/meta.AbstractClass
80
+ */
81
+
82
+ /**
83
+ * A *factory* for special types of JS `function` constructors.
84
+ * @name module:@lumjs/core.Functions
85
+ * @see module:@lumjs/core/meta.Functions
86
+ */
87
+
88
+ /**
89
+ * Throw an `Error` saying that a feature is not yet implemented.
90
+ * @name module:@lumjs/core.NYI
91
+ * @function
92
+ * @see module:@lumjs/core/meta.NYI
93
+ */
94
+
95
+ // These are exported directly, but a meta sub-module also exists.
96
+ // Unlike most sub-modules there is no `meta` property in the main library.
97
+ const {stacktrace,AbstractClass,Functions,NYI} = require('./meta');
98
+
99
+ /**
100
+ * Create a magic *Enum* object.
101
+ * @alias module:@lumjs/core.Enum
102
+ * @function
103
+ * @see module:@lumjs/core/enum
104
+ */
105
+ const Enum = require('./enum');
106
+
107
+ /**
108
+ * Make an object support the *Observable* API.
109
+ * @alias module:@lumjs/core.observable
110
+ * @function
111
+ * @see module:@lumjs/core/observable
112
+ */
113
+ const observable = require('./observable');
114
+
115
+ // One function exported directly with no sub-module available.
116
+ const lazy = require('./lazy');
117
+
118
+ /**
119
+ * Define properties on an object or function.
120
+ * @alias module:@lumjs/core.def
121
+ * @function
122
+ * @see module:@lumjs/core/types.def
123
+ */
124
+ const def = types.def;
125
+
126
+ module.exports =
127
+ {
128
+ types, arrays, context, strings, flags, obj, opt, modules,
129
+ def, randomNumber, InternalObjectId, Enum, lazy, observable,
130
+ stacktrace, AbstractClass, Functions, NYI,
131
+ }