cno-bedrock 0.0.5 → 0.1.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [0.1.0](https://github.com/Anadian/cno-bedrock/compare/v0.0.5...v0.1.0) (2026-11-29)
6
+
7
+
8
+ ### Features
9
+
10
+ * Big additions including cno-files, cno-test* and plenty more cno-utility functions. ([be656e7](https://github.com/Anadian/cno-bedrock/commit/be656e7ecf2168bbee571467be387ee6b8673797))
11
+ * Finally got cno-sha2-256 working. ([d0567b2](https://github.com/Anadian/cno-bedrock/commit/d0567b219c2deea2d7dd59c95f4b2c0b978541c0))
12
+ * TimedCacheMap ([6622f99](https://github.com/Anadian/cno-bedrock/commit/6622f9979d881d0015fb672bbb28eab1a90fc352))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * Exports for previous commit. ([1aa8ab2](https://github.com/Anadian/cno-bedrock/commit/1aa8ab2054ce82331c07e5d73b224b8eb496ab5b))
18
+
19
+
20
+ ### Refactoring
21
+
22
+ * Moved isStrictlyNotEqual and isNullOrEmpty to utility to clean up lib.js ([ca740a7](https://github.com/Anadian/cno-bedrock/commit/ca740a7e6601c00b5806504b22facc887e74cd73))
23
+
24
+
25
+ ### Tests
26
+
27
+ * Basic usage test for `cno-tree`. ([e1ff4af](https://github.com/Anadian/cno-bedrock/commit/e1ff4af076826dd3f3a3a41d5ed7e412b87cbbb5))
28
+ * Completed tests and coverage for `cno-math`. ([17e37e4](https://github.com/Anadian/cno-bedrock/commit/17e37e4ae7a7dfc529a34a2e937e88f04d9cc14d))
29
+ * Tests for `cno-vector.js` ([0cda317](https://github.com/Anadian/cno-bedrock/commit/0cda317157cd33e16139e1d55e46c55ac69c598f))
30
+
5
31
  ### [0.0.5](https://github.com/Anadian/cno-bedrock/compare/v0.0.4...v0.0.5) (2025-11-08)
6
32
 
7
33
 
package/package.json CHANGED
@@ -1,117 +1,117 @@
1
1
  {
2
- "name": "cno-bedrock",
3
- "version": "0.0.5",
4
- "description": "Micropackage: a test bed for various small pieces of reusable code.",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/Anadian/cno-bedrock.git"
8
- },
9
- "author": "Anadian",
10
- "license": "MIT",
11
- "type": "module",
12
- "exports": {
13
- ".": "./src/lib.js"
14
- },
15
- "engines": {
16
- "node": ">=18"
17
- },
18
- "bugs": {
19
- "url": "https://github.com/Anadian/cno-bedrock/issues"
20
- },
21
- "homepage": "https://github.com/Anadian/cno-bedrock#readme",
22
- "keywords": [
23
- "cno",
24
- "framework",
25
- "minimal",
26
- "essential",
27
- "micro",
28
- "micropackage",
29
- "libre",
30
- "free",
31
- "open",
32
- "mit"
33
- ],
34
- "standard-version": {
35
- "types": [
36
- {
37
- "type": "build",
38
- "section": "Build",
39
- "hidden": false
40
- },
41
- {
42
- "type": "ci",
43
- "section": "Continuous Integration",
44
- "hidden": false
45
- },
46
- {
47
- "type": "chore",
48
- "section": "Chores",
49
- "hidden": false
50
- },
51
- {
52
- "type": "docs",
53
- "section": "Documentation",
54
- "hidden": false
55
- },
56
- {
57
- "type": "feat",
58
- "section": "Features",
59
- "hidden": false
60
- },
61
- {
62
- "type": "fix",
63
- "section": "Bug Fixes",
64
- "hidden": false
65
- },
66
- {
67
- "type": "perf",
68
- "section": "Performance",
69
- "hidden": false
70
- },
71
- {
72
- "type": "refactor",
73
- "section": "Refactoring",
74
- "hidden": false
75
- },
76
- {
77
- "type": "style",
78
- "section": "Code Style",
79
- "hidden": false
80
- },
81
- {
82
- "type": "test",
83
- "section": "Tests",
84
- "hidden": false
85
- }
86
- ]
87
- },
88
- "bin": {
89
- "cno-bedrock": "./src/cli.js"
90
- },
91
- "devDependencies": {
92
- "c8": "^10.1.3",
93
- "eslint": "^9.39.1",
94
- "extract-documentation-comments": "^0.4.2",
95
- "hjson": "^3.2.2",
96
- "npm-check-updates": "^19.1.2",
97
- "shelljs": "^0.10.0",
98
- "standard-version": "^9.5.0"
99
- },
100
- "dependencies": {
101
- "lodash": "^4.17.21",
102
- "mathjs": "^15.1.0",
103
- "nanoid": "^5.1.6"
104
- },
105
- "scripts": {
106
- "test": "node --test ./src/lib.test.js",
107
- "coverage": "c8 pnpm test",
108
- "coverage-report": "c8 report -r=text-lcov > coverage/lcov.txt",
109
- "do-ci": "pnpm coverage && pnpm coverage-report",
110
- "lint": "eslint ./src/main.js",
111
- "generate-docs": "scripts/generate-docs.js",
112
- "update-config": "hjson -j ci/github-actions.hjson | json2yaml -o .github/workflows/ci.yml && git change 'chore: Updated GitHub Actions.'",
113
- "update-deps": "npm-check-updates -u",
114
- "release": "standard-version",
115
- "publish-release": "git push --follow-tags origin main && pnpm publish"
116
- }
117
- }
2
+ "name": "cno-bedrock",
3
+ "version": "0.1.0",
4
+ "description": "Micropackage: a test bed for various small pieces of reusable code.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Anadian/cno-bedrock.git"
8
+ },
9
+ "author": "Anadian",
10
+ "license": "MIT",
11
+ "type": "module",
12
+ "exports": {
13
+ ".": "./src/lib.js"
14
+ },
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/Anadian/cno-bedrock/issues"
20
+ },
21
+ "homepage": "https://github.com/Anadian/cno-bedrock#readme",
22
+ "keywords": [
23
+ "cno",
24
+ "framework",
25
+ "minimal",
26
+ "essential",
27
+ "micro",
28
+ "micropackage",
29
+ "libre",
30
+ "free",
31
+ "open",
32
+ "mit"
33
+ ],
34
+ "scripts": {
35
+ "test": "node --test ./src/*.test.js",
36
+ "coverage": "c8 pnpm test",
37
+ "coverage-report": "c8 report -r=text-lcov > coverage/lcov.txt",
38
+ "do-ci": "pnpm coverage && pnpm coverage-report",
39
+ "lint": "eslint ./src/main.js",
40
+ "generate-docs": "scripts/generate-docs.js",
41
+ "update-config": "hjson -j ci/github-actions.hjson | json2yaml -o .github/workflows/ci.yml && git change 'chore: Updated GitHub Actions.'",
42
+ "update-deps": "npm-check-updates -u",
43
+ "release": "standard-version",
44
+ "publish-release": "git push --follow-tags origin main && pnpm publish"
45
+ },
46
+ "standard-version": {
47
+ "types": [
48
+ {
49
+ "type": "build",
50
+ "section": "Build",
51
+ "hidden": false
52
+ },
53
+ {
54
+ "type": "ci",
55
+ "section": "Continuous Integration",
56
+ "hidden": false
57
+ },
58
+ {
59
+ "type": "chore",
60
+ "section": "Chores",
61
+ "hidden": false
62
+ },
63
+ {
64
+ "type": "docs",
65
+ "section": "Documentation",
66
+ "hidden": false
67
+ },
68
+ {
69
+ "type": "feat",
70
+ "section": "Features",
71
+ "hidden": false
72
+ },
73
+ {
74
+ "type": "fix",
75
+ "section": "Bug Fixes",
76
+ "hidden": false
77
+ },
78
+ {
79
+ "type": "perf",
80
+ "section": "Performance",
81
+ "hidden": false
82
+ },
83
+ {
84
+ "type": "refactor",
85
+ "section": "Refactoring",
86
+ "hidden": false
87
+ },
88
+ {
89
+ "type": "style",
90
+ "section": "Code Style",
91
+ "hidden": false
92
+ },
93
+ {
94
+ "type": "test",
95
+ "section": "Tests",
96
+ "hidden": false
97
+ }
98
+ ]
99
+ },
100
+ "bin": {
101
+ "cno-bedrock": "./src/cli.js"
102
+ },
103
+ "devDependencies": {
104
+ "c8": "^12.0.0",
105
+ "eslint": "^10.8.1",
106
+ "extract-documentation-comments": "^0.4.2",
107
+ "hjson": "^3.2.2",
108
+ "npm-check-updates": "^23.0.2",
109
+ "shelljs": "^0.10.0",
110
+ "standard-version": "^9.5.0"
111
+ },
112
+ "dependencies": {
113
+ "lodash": "^4.18.1",
114
+ "mathjs": "^15.2.0",
115
+ "nanoid": "^6.0.1"
116
+ }
117
+ }
File without changes
package/src/cno-assert.js CHANGED
@@ -41,6 +41,157 @@ const FILENAME = 'cno-assert.js';
41
41
 
42
42
  //# Global Variables
43
43
  /**## Functions*/
44
+
45
+ /**
46
+ ### assertTruthy
47
+ > Throws if `value` isn't truthy.
48
+
49
+ #### Parametres
50
+ | name | type | description |
51
+ | --- | --- | --- |
52
+ | actual | any | The actual value. |
53
+
54
+ #### Throws
55
+ | code | type | condition |
56
+ | --- | --- | --- |
57
+ | 'ERR_ASSERTION_SAMETYPE' | AssertionError | Thrown if `!value`. |
58
+
59
+ #### History
60
+ | version | change |
61
+ | --- | --- |
62
+ | 0.0.3 | WIP |
63
+ */
64
+ export function assertTruthy( actual ){
65
+ // Constants
66
+ const FUNCTION_NAME = 'assertTruthy';
67
+ // Variables
68
+ var return_error = null;
69
+ var message = '';
70
+ // Function
71
+ try{
72
+ AssertNS( actual );
73
+ } catch( error ){
74
+ //if( typeof(actual) !== typeof(expected) ){
75
+ message = `'actual' (${actual}) is not truthy.`;
76
+ return_error = new AssertNS.AssertionError( { message: message, actual: actual, expected: true, operator: 'Truthy' } );
77
+ return_error.code += '_TRUTHY';
78
+ return_error.cause = error;
79
+ annotateThis.call( return_error );
80
+ throw return_error;
81
+ }
82
+ } // assertTruthy
83
+ /**
84
+ ### assertNumber
85
+ > Throws if `value` isn't a number.
86
+
87
+ #### Parametres
88
+ | name | type | description |
89
+ | --- | --- | --- |
90
+ | actual | any | The actual value. |
91
+
92
+ #### Throws
93
+ | code | type | condition |
94
+ | --- | --- | --- |
95
+ | 'ERR_ASSERTION_SAMETYPE' | AssertionError | Thrown if `typeof(actual) != 'number'`. |
96
+
97
+ #### History
98
+ | version | change |
99
+ | --- | --- |
100
+ | 0.0.3 | WIP |
101
+ */
102
+ export function assertNumber( actual ){
103
+ // Constants
104
+ const FUNCTION_NAME = 'assertNumber';
105
+ // Variables
106
+ var return_error = null;
107
+ var message = '';
108
+ // Function
109
+ try{
110
+ AssertNS.deepStrictEqual( typeof(actual), 'number' );
111
+ } catch( error ){
112
+ //if( typeof(actual) !== typeof(expected) ){
113
+ message = `'actual' (${actual}) is not number.`;
114
+ return_error = new AssertNS.AssertionError( { message: message, actual: actual, expected: true, operator: 'Number' } );
115
+ return_error.code += '_NUMBER';
116
+ return_error.cause = error;
117
+ annotateThis.call( return_error );
118
+ throw return_error;
119
+ }
120
+ } // assertNumber
121
+ /**
122
+ ### assertLessThan
123
+ > Throws if actual is not less than expected or if either isn't a number.
124
+
125
+ #### Parametres
126
+ | name | type | description |
127
+ | --- | --- | --- |
128
+ | actual | any | The actual value. |
129
+ | expected | any | The expected value. |
130
+
131
+ #### Throws
132
+ | code | type | condition |
133
+ | --- | --- | --- |
134
+ | 'ERR_ASSERTION_SAMETYPE' | AssertionError | Thrown if `actual >= expected`. |
135
+
136
+ #### History
137
+ | version | change |
138
+ | --- | --- |
139
+ | 0.0.3 | WIP |
140
+ */
141
+ export function assertLessThan( actual, expected ){
142
+ // Constants
143
+ const FUNCTION_NAME = 'assertLessThan';
144
+ // Variables
145
+ var return_error = null;
146
+ var message = '';
147
+ // Function
148
+ assertNumber( actual );
149
+ assertNumber( expected );
150
+ if( actual >= expected ){
151
+ message = `'actual' (${actual}) is not less than 'expected' (${expected}).`;
152
+ return_error = new AssertNS.AssertionError( { message: message, actual: actual, expected: expected, operator: 'LessThan' } );
153
+ return_error.code += '_LESSTHAN';
154
+ annotateThis.call( return_error );
155
+ throw return_error;
156
+ }
157
+ } // assertLessThan
158
+ /**
159
+ ### assertGreaterThan
160
+ > Throws if actual is not greater than expected or if either isn't a number.
161
+
162
+ #### Parametres
163
+ | name | type | description |
164
+ | --- | --- | --- |
165
+ | actual | any | The actual value. |
166
+ | expected | any | The expected value. |
167
+
168
+ #### Throws
169
+ | code | type | condition |
170
+ | --- | --- | --- |
171
+ | 'ERR_ASSERTION_SAMETYPE' | AssertionError | Thrown if `actual <= expected`. |
172
+
173
+ #### History
174
+ | version | change |
175
+ | --- | --- |
176
+ | 0.0.3 | WIP |
177
+ */
178
+ export function assertGreaterThan( actual, expected ){
179
+ // Constants
180
+ const FUNCTION_NAME = 'assertGreaterThan';
181
+ // Variables
182
+ var return_error = null;
183
+ var message = '';
184
+ // Function
185
+ assertNumber( actual );
186
+ assertNumber( expected );
187
+ if( actual <= expected ){
188
+ message = `'actual' (${actual}) is not greater than 'expected' (${expected}).`;
189
+ return_error = new AssertNS.AssertionError( { message: message, actual: actual, expected: expected, operator: 'GreaterThan' } );
190
+ return_error.code += '_GREATERTHAN';
191
+ annotateThis.call( return_error );
192
+ throw return_error;
193
+ }
194
+ } // assertGreaterThan
44
195
  /**
45
196
  ### assertSameType
46
197
  > Throws if actual's type is not the same as expected's, according to a strict `typeof` comparison.
@@ -62,7 +213,7 @@ const FILENAME = 'cno-assert.js';
62
213
  | 0.0.3 | Removed message parametre. |
63
214
  | 0.0.1 | WIP |
64
215
  */
65
- function assertSameType( actual, expected ){
216
+ export function assertSameType( actual, expected ){
66
217
  // Constants
67
218
  const FUNCTION_NAME = 'assertSameType';
68
219
  // Variables
@@ -98,7 +249,7 @@ function assertSameType( actual, expected ){
98
249
  | 0.0.3 | Redone |
99
250
  | 0.0.1 | WIP |
100
251
  */
101
- function assertNonstrictNotEqual( actual, expected ){
252
+ export function assertNonstrictNotEqual( actual, expected ){
102
253
  // Constants
103
254
  const FUNCTION_NAME = 'assertNonstrictNotEqual';
104
255
  // Variables
@@ -115,7 +266,7 @@ function assertNonstrictNotEqual( actual, expected ){
115
266
  } // assertNonstrictNotEqual
116
267
  /**
117
268
  ### assertIsEmpty
118
- > Throws if `actual` is not empty.
269
+ > Throws if `actual` is not empty via [`_.isEmpty`](https://lodash.com/docs/4.17.21#isEmpty).
119
270
 
120
271
  #### Parametres
121
272
  | name | type | description |
@@ -130,12 +281,13 @@ function assertNonstrictNotEqual( actual, expected ){
130
281
  #### History
131
282
  | version | change |
132
283
  | --- | --- |
284
+ | 0.1.1 | Uses lodash's `isEmpty` function. |
133
285
  | 0.0.3 | WIP |
134
286
  */
135
- function assertIsEmpty( actual ){
287
+ export function assertIsEmpty( actual ){
136
288
  var return_error = null;
137
- if( actual.length !== 0 ){
138
- return_error = new AssertNS.AssertionError( { message: `'actual' (${actual}) has a non-zero length.`, actual: actual, operator: 'IsEmpty' } );
289
+ if( _.isEmpty( actual ) !== true ){
290
+ return_error = new AssertNS.AssertionError( { message: `'actual' (${actual}) is not empty.`, actual: actual, operator: 'IsEmpty' } );
139
291
  return_error.code += '_ISEMPTY';
140
292
  throw return_error;
141
293
  }
@@ -159,7 +311,7 @@ function assertIsEmpty( actual ){
159
311
  | --- | --- |
160
312
  | 0.0.3 | WIP |
161
313
  */
162
- function assertIsNullOrUndefined( actual ){
314
+ export function assertIsNullOrUndefined( actual ){
163
315
  var return_error = null;
164
316
  if( actual !== null && actual !== undefined ){
165
317
  return_error = new AssertNS.AssertionError( { message: `'actual' (${actual}) is neither null nor undefined.`, actual: actual, operator: 'IsNullOrUndefined' } );
@@ -186,7 +338,7 @@ function assertIsNullOrUndefined( actual ){
186
338
  | --- | --- |
187
339
  | 0.0.3 | WIP |
188
340
  */
189
- function assertIsNullOrEmpty( actual ){
341
+ export function assertIsNullOrEmpty( actual ){
190
342
  // Constants
191
343
  const FUNCTION_NAME = 'assertIsNullOrEmpty';
192
344
  // Variables
@@ -233,7 +385,7 @@ function assertIsNullOrEmpty( actual ){
233
385
  #### Throws
234
386
  | code | type | condition |
235
387
  | --- | --- | --- |
236
- | 'ERR_ASSERTION_STRICTLYNOTEQUAL' | AssertionError | Thrown if actual is not strictly-not-equal (`=!=`) to expected. |
388
+ | 'ERR_ASSERTION_STRICTLYNOTEQUAL' | AssertionError | Thrown if actual is not strictly-not-equal (` != `) && typeof((`) === typeof(`)) to expected. |
237
389
 
238
390
  #### History
239
391
  | version | change |
@@ -241,7 +393,7 @@ function assertIsNullOrEmpty( actual ){
241
393
  | 0.0.3 | Removed message parametre. |
242
394
  | 0.0.1 | WIP |
243
395
  */
244
- function assertStrictlyNotEqual( actual, expected, name, value, expectedType ){
396
+ export function assertStrictlyNotEqual( actual, expected, name, value, expectedType ){
245
397
  // Constants
246
398
  const FUNCTION_NAME = 'assertStrictlyNotEqual';
247
399
  // Variables
@@ -291,7 +443,7 @@ function assertStrictlyNotEqual( actual, expected, name, value, expectedType ){
291
443
  | 0.0.3 | Removed message parametre. |
292
444
  | 0.0.1 | WIP |
293
445
  */
294
- function assertInstanceof( actual, expected ){
446
+ export function assertInstanceof( actual, expected ){
295
447
  // Constants
296
448
  const FUNCTION_NAME = 'assertInstanceof';
297
449
  // Variables
@@ -326,7 +478,7 @@ function assertInstanceof( actual, expected ){
326
478
  | --- | --- |
327
479
  | 0.0.1 | WIP |
328
480
  */
329
- function assertExpectedError( actual, expected ){
481
+ export function assertExpectedError( actual, expected ){
330
482
  // Constants
331
483
  const FUNCTION_NAME = 'assertExpectedError';
332
484
  // Variables
@@ -372,7 +524,7 @@ function assertExpectedError( actual, expected ){
372
524
  | 0.0.3 | Removed message parametre. |
373
525
  | 0.0.1 | WIP |
374
526
  */
375
- function assertObjectsQuantitativelyEqual( actual, expected ){
527
+ export function assertObjectsQuantitativelyEqual( actual, expected ){
376
528
 
377
529
  // Constants
378
530
  const FUNCTION_NAME = 'assertObjectsQuantitativelyEqual';
@@ -408,7 +560,7 @@ function assertObjectsQuantitativelyEqual( actual, expected ){
408
560
  | 0.0.3 | Removed message parametre. |
409
561
  | 0.0.1 | WIP |
410
562
  */
411
- function assertNullOrFunction( actual ){
563
+ export function assertNullOrFunction( actual ){
412
564
  // Constants
413
565
  const FUNCTION_NAME = 'assertNullOrFunction';
414
566
  // Variables
@@ -442,7 +594,7 @@ function assertNullOrFunction( actual ){
442
594
  | --- | --- |
443
595
  | 0.0.5 | WIP |
444
596
  */
445
- function assertIsMap( actual ){
597
+ export function assertIsMap( actual ){
446
598
  // Constants
447
599
  const FUNCTION_NAME = 'assertIsMap';
448
600
  // Variables
@@ -460,6 +612,22 @@ function assertIsMap( actual ){
460
612
 
461
613
  const NAMESPACE = { ...AssertNS };
462
614
  Object.defineProperties( NAMESPACE, {
615
+ assertTruthy: {
616
+ value: assertTruthy,
617
+ enumerable: true
618
+ },
619
+ assertNumber: {
620
+ value: assertNumber,
621
+ enumerable: true
622
+ },
623
+ assertLessThan: {
624
+ value: assertLessThan,
625
+ enumerable: true
626
+ },
627
+ assertGreaterThan: {
628
+ value: assertGreaterThan,
629
+ enumerable: true
630
+ },
463
631
  assertSameType: {
464
632
  value: assertSameType,
465
633
  enumerable: true
@@ -506,7 +674,8 @@ Object.defineProperties( NAMESPACE, {
506
674
  }
507
675
  } );
508
676
 
509
- export default NAMESPACE;
677
+ export { NAMESPACE as default };
678
+ export * from 'node:assert/strict';
510
679
 
511
680
  // cno-assert.js EOF
512
681