$
This commit is contained in:
21
node_modules/symbol-tree/LICENSE
generated
vendored
Normal file
21
node_modules/symbol-tree/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Joris van der Wel
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
545
node_modules/symbol-tree/README.md
generated
vendored
Normal file
545
node_modules/symbol-tree/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
838
node_modules/symbol-tree/lib/SymbolTree.js
generated
vendored
Normal file
838
node_modules/symbol-tree/lib/SymbolTree.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
54
node_modules/symbol-tree/lib/SymbolTreeNode.js
generated
vendored
Normal file
54
node_modules/symbol-tree/lib/SymbolTreeNode.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = class SymbolTreeNode {
|
||||
constructor() {
|
||||
this.parent = null;
|
||||
this.previousSibling = null;
|
||||
this.nextSibling = null;
|
||||
|
||||
this.firstChild = null;
|
||||
this.lastChild = null;
|
||||
|
||||
/** This value is incremented anytime a children is added or removed */
|
||||
this.childrenVersion = 0;
|
||||
/** The last child object which has a cached index */
|
||||
this.childIndexCachedUpTo = null;
|
||||
|
||||
/** This value represents the cached node index, as long as
|
||||
* cachedIndexVersion matches with the childrenVersion of the parent */
|
||||
this.cachedIndex = -1;
|
||||
this.cachedIndexVersion = NaN; // NaN is never equal to anything
|
||||
}
|
||||
|
||||
get isAttached() {
|
||||
return Boolean(this.parent || this.previousSibling || this.nextSibling);
|
||||
}
|
||||
|
||||
get hasChildren() {
|
||||
return Boolean(this.firstChild);
|
||||
}
|
||||
|
||||
childrenChanged() {
|
||||
/* jshint -W016 */
|
||||
// integer wrap around
|
||||
this.childrenVersion = (this.childrenVersion + 1) & 0xFFFFFFFF;
|
||||
this.childIndexCachedUpTo = null;
|
||||
}
|
||||
|
||||
getCachedIndex(parentNode) {
|
||||
// (assumes parentNode is actually the parent)
|
||||
if (this.cachedIndexVersion !== parentNode.childrenVersion) {
|
||||
this.cachedIndexVersion = NaN;
|
||||
// cachedIndex is no longer valid
|
||||
return -1;
|
||||
}
|
||||
|
||||
return this.cachedIndex; // -1 if not cached
|
||||
}
|
||||
|
||||
setCachedIndex(parentNode, index) {
|
||||
// (assumes parentNode is actually the parent)
|
||||
this.cachedIndexVersion = parentNode.childrenVersion;
|
||||
this.cachedIndex = index;
|
||||
}
|
||||
};
|
69
node_modules/symbol-tree/lib/TreeIterator.js
generated
vendored
Normal file
69
node_modules/symbol-tree/lib/TreeIterator.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
'use strict';
|
||||
|
||||
const TREE = Symbol();
|
||||
const ROOT = Symbol();
|
||||
const NEXT = Symbol();
|
||||
const ITERATE_FUNC = Symbol();
|
||||
|
||||
class TreeIterator {
|
||||
constructor(tree, root, firstResult, iterateFunction) {
|
||||
this[TREE] = tree;
|
||||
this[ROOT] = root;
|
||||
this[NEXT] = firstResult;
|
||||
this[ITERATE_FUNC] = iterateFunction;
|
||||
}
|
||||
|
||||
next() {
|
||||
const tree = this[TREE];
|
||||
const iterateFunc = this[ITERATE_FUNC];
|
||||
const root = this[ROOT];
|
||||
|
||||
if (!this[NEXT]) {
|
||||
return {
|
||||
done: true,
|
||||
value: root,
|
||||
};
|
||||
}
|
||||
|
||||
const value = this[NEXT];
|
||||
|
||||
if (iterateFunc === 1) {
|
||||
this[NEXT] = tree._node(value).previousSibling;
|
||||
}
|
||||
else if (iterateFunc === 2) {
|
||||
this[NEXT] = tree._node(value).nextSibling;
|
||||
}
|
||||
else if (iterateFunc === 3) {
|
||||
this[NEXT] = tree._node(value).parent;
|
||||
}
|
||||
else if (iterateFunc === 4) {
|
||||
this[NEXT] = tree.preceding(value, {root: root});
|
||||
}
|
||||
else /* if (iterateFunc === 5)*/ {
|
||||
this[NEXT] = tree.following(value, {root: root});
|
||||
}
|
||||
|
||||
return {
|
||||
done: false,
|
||||
value: value,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(TreeIterator.prototype, Symbol.iterator, {
|
||||
value: function() {
|
||||
return this;
|
||||
},
|
||||
writable: false,
|
||||
});
|
||||
|
||||
TreeIterator.PREV = 1;
|
||||
TreeIterator.NEXT = 2;
|
||||
TreeIterator.PARENT = 3;
|
||||
TreeIterator.PRECEDING = 4;
|
||||
TreeIterator.FOLLOWING = 5;
|
||||
|
||||
Object.freeze(TreeIterator);
|
||||
Object.freeze(TreeIterator.prototype);
|
||||
|
||||
module.exports = TreeIterator;
|
11
node_modules/symbol-tree/lib/TreePosition.js
generated
vendored
Normal file
11
node_modules/symbol-tree/lib/TreePosition.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
module.exports = Object.freeze({
|
||||
// same as DOM DOCUMENT_POSITION_
|
||||
DISCONNECTED: 1,
|
||||
PRECEDING: 2,
|
||||
FOLLOWING: 4,
|
||||
CONTAINS: 8,
|
||||
CONTAINED_BY: 16,
|
||||
});
|
47
node_modules/symbol-tree/package.json
generated
vendored
Normal file
47
node_modules/symbol-tree/package.json
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "symbol-tree",
|
||||
"version": "3.2.4",
|
||||
"description": "Turn any collection of objects into its own efficient tree or linked list using Symbol",
|
||||
"main": "lib/SymbolTree.js",
|
||||
"scripts": {
|
||||
"lint": "eslint lib test",
|
||||
"test": "istanbul cover test/SymbolTree.js",
|
||||
"posttest": "npm run lint",
|
||||
"ci": "istanbul cover test/SymbolTree.js --report lcovonly && cat ./coverage/lcov.info | coveralls",
|
||||
"postci": "npm run posttest",
|
||||
"predocumentation": "cp readme-header.md README.md",
|
||||
"documentation": "jsdoc2md --files lib/SymbolTree.js >> README.md"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jsdom/js-symbol-tree.git"
|
||||
},
|
||||
"keywords": [
|
||||
"list",
|
||||
"queue",
|
||||
"stack",
|
||||
"linked-list",
|
||||
"tree",
|
||||
"es6",
|
||||
"dom",
|
||||
"symbol"
|
||||
],
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"author": "Joris van der Wel <joris@jorisvanderwel.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jsdom/js-symbol-tree/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jsdom/js-symbol-tree#symbol-tree",
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^10.0.1",
|
||||
"coveralls": "^3.0.0",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-import": "^2.2.0",
|
||||
"istanbul": "^0.4.5",
|
||||
"jsdoc-to-markdown": "^5.0.0",
|
||||
"tape": "^4.0.0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user