@bablr/btree 0.1.0 → 0.1.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.
@@ -11,6 +11,22 @@ export const buildModule = (NODE_SIZE = 8) => {
11
11
 
12
12
  const treeFrom = (...trees) => [sumNodes(trees), trees];
13
13
 
14
+ const from = (...values) => {
15
+ let tree = [];
16
+ for (const value of values) {
17
+ tree = push(tree, value);
18
+ }
19
+ return tree;
20
+ };
21
+
22
+ const fromValues = (values) => {
23
+ let tree = [];
24
+ for (const value of values) {
25
+ tree = push(tree, value);
26
+ }
27
+ return tree;
28
+ };
29
+
14
30
  const findBalancePoint = (tree) => {
15
31
  const values = isFinite(tree[0]) ? tree[1] : tree;
16
32
  let leftSum = 0;
@@ -375,7 +391,8 @@ export const buildModule = (NODE_SIZE = 8) => {
375
391
 
376
392
  return {
377
393
  buildModule,
378
- treeFrom,
394
+ from,
395
+ fromValues,
379
396
  findBalancePoint,
380
397
  split,
381
398
  collapses,
package/lib/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { buildModule } from './enhanceable.js';
2
2
 
3
3
  export const {
4
- treeFrom,
4
+ from,
5
+ fromValues,
6
+
5
7
  findBalancePoint,
6
8
  split,
7
9
  collapses,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bablr/btree",
3
3
  "description": "Functional utilities for working with btrees such as those used in agAST",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "author": "Conrad Buck<conartist6@gmail.com>",
6
6
  "type": "module",
7
7
  "files": [