splaytree 3.0.0 → 3.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.
package/dist/splay.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"splay.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"splay.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,14 +1,18 @@
1
1
  {
2
2
  "name": "splaytree",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "author": "Alexander Milevski <info@w8r.name>",
5
5
  "license": "MIT",
6
6
  "description": "Fast Splay tree for Node and browser",
7
7
  "main": "dist/splay.js",
8
+ "browser": "dist/splay.js",
9
+ "unpkg": "dist/splay.js",
8
10
  "module": "dist/splay.esm.js",
9
11
  "types": "typings/index.d.ts",
10
12
  "files": [
11
- "dist", "typings", "src"
13
+ "dist",
14
+ "typings",
15
+ "src"
12
16
  ],
13
17
  "directories": {
14
18
  "test": "test",
@@ -29,7 +33,8 @@
29
33
  "test": "nyc mocha tests/**/*.test.ts",
30
34
  "posttest": "nyc report --reporter=json",
31
35
  "prepublishOnly": "npm run build && npm test",
32
- "clean": "rm -rf dist coverage .nyc"
36
+ "clean": "rm -rf dist coverage .nyc",
37
+ "coverage": "codecov -f coverage/*.json"
33
38
  },
34
39
  "devDependencies": {
35
40
  "@types/chai": "^4.1.4",
@@ -38,12 +43,13 @@
38
43
  "benchmark": "^2.1.4",
39
44
  "bintrees": "^1.0.2",
40
45
  "chai": "^4.2.0",
41
- "mocha": "^6.0.2",
42
- "nodemon": "^1.17.5",
43
- "nyc": "^13.3.0",
46
+ "codecov": "^3.8.3",
47
+ "mocha": "^6.2.0",
48
+ "nodemon": "^1.19.2",
49
+ "nyc": "^14.1.1",
44
50
  "reify": "*",
45
51
  "rollup": "*",
46
- "rollup-plugin-typescript2": "*",
52
+ "rollup-plugin-typescript2": "^0.24.1",
47
53
  "ts-node": "^6.1.1",
48
54
  "tslib": "^1.9.3",
49
55
  "tslint": "^5.14.0",
package/src/index.ts CHANGED
@@ -381,13 +381,13 @@ export default class Tree<Key=number, Value=any> {
381
381
  }
382
382
 
383
383
 
384
- public minNode(t = this._root) : Node<Key, Value> {
384
+ public minNode(t = this._root) : Node<Key, Value> | null {
385
385
  if (t) while (t.left) t = t.left;
386
386
  return t;
387
387
  }
388
388
 
389
389
 
390
- public maxNode(t = this._root) : Node<Key, Value> {
390
+ public maxNode(t = this._root) : Node<Key, Value> | null {
391
391
  if (t) while (t.right) t = t.right;
392
392
  return t;
393
393
  }
@@ -529,6 +529,14 @@ export default class Tree<Key=number, Value=any> {
529
529
  public split(key:Key) {
530
530
  return split(key, this._root, this._comparator);
531
531
  }
532
+
533
+ *[Symbol.iterator]() {
534
+ let n = this.minNode();
535
+ while (n) {
536
+ yield n;
537
+ n = this.next(n);
538
+ }
539
+ }
532
540
  }
533
541
 
534
542
 
@@ -54,8 +54,8 @@ export default class Tree<Key = number, Value = any> {
54
54
  values(): Value[];
55
55
  min(): Key | null;
56
56
  max(): Key | null;
57
- minNode(t?: Node<Key, Value>): Node<Key, Value>;
58
- maxNode(t?: Node<Key, Value>): Node<Key, Value>;
57
+ minNode(t?: Node<Key, Value>): Node<Key, Value> | null;
58
+ maxNode(t?: Node<Key, Value>): Node<Key, Value> | null;
59
59
  /**
60
60
  * Returns node at given index
61
61
  */
@@ -77,5 +77,6 @@ export default class Tree<Key = number, Value = any> {
77
77
  left: Node<any, any>;
78
78
  right: Node<any, any>;
79
79
  };
80
+ [Symbol.iterator](): IterableIterator<Node<Key, Value>>;
80
81
  }
81
82
  export {};