webdetector/.cache/1f/eb3eadd9706d54654be49f278bb757.json

1 line
166 KiB
JSON
Raw Normal View History

2018-12-21 12:36:28 +00:00
{"id":"../node_modules/symbol-tree/lib/SymbolTree.js","dependencies":[{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/package.json","includedInParent":true,"mtime":1545395695572},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/symbol-tree/package.json","includedInParent":true,"mtime":1545395355516},{"name":"./SymbolTreeNode","loc":{"line":8,"column":31},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/symbol-tree/lib/SymbolTree.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/symbol-tree/lib/SymbolTreeNode.js"},{"name":"./TreePosition","loc":{"line":9,"column":29},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/symbol-tree/lib/SymbolTree.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/symbol-tree/lib/TreePosition.js"},{"name":"./TreeIterator","loc":{"line":10,"column":29},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/symbol-tree/lib/SymbolTree.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/symbol-tree/lib/TreeIterator.js"}],"generated":{"js":"'use strict';\n\n/**\n * @module symbol-tree\n * @author Joris van der Wel <joris@jorisvanderwel.com>\n */\n\nconst SymbolTreeNode = require('./SymbolTreeNode');\nconst TreePosition = require('./TreePosition');\nconst TreeIterator = require('./TreeIterator');\n\nfunction returnTrue() {\n return true;\n}\n\nfunction reverseArrayIndex(array, reverseIndex) {\n return array[array.length - 1 - reverseIndex]; // no need to check `index >= 0`\n}\n\nclass SymbolTree {\n\n /**\n * @constructor\n * @alias module:symbol-tree\n * @param {string} [description='SymbolTree data'] Description used for the Symbol\n */\n constructor(description) {\n this.symbol = Symbol(description || 'SymbolTree data');\n }\n\n /**\n * You can use this function to (optionally) initialize an object right after its creation,\n * to take advantage of V8's fast properties. Also useful if you would like to\n * freeze your object.\n *\n * `O(1)`\n *\n * @method\n * @alias module:symbol-tree#initialize\n * @param {Object} object\n * @return {Object} object\n */\n initialize(object) {\n this._node(object);\n\n return object;\n }\n\n _node(object) {\n if (!object) {\n return null;\n }\n\n const node = object[this.symbol];\n\n if (node) {\n return node;\n }\n\n return (object[this.symbol] = new SymbolTreeNode());\n }\n\n /**\n * Returns `true` if the object has any children. Otherwise it returns `false`.\n *\n * * `O(1)`\n *\n * @method hasChildren\n * @memberOf module:symbol-tree#\n * @param {Object} object\n * @return {Boolean}\n */\n hasChildren(object) {\n return this._node(object).hasChildren;\n }\n\n /**\n * Returns the first child of the given object.\n *\n * * `O(1)`\n *\n * @method firstChild\n * @memberOf module:symbol-tree#\n * @param {Object} object\n * @return {Object}\n */\n firstChild(object) {\n return this._node(object).firstChild;\n }\n\n /**\n * Returns the last child of the given object.\n *\n * * `O(1)`\n *\n * @method lastChild\n * @memberOf module:symbol-tree#\n * @param {Object} object\n * @return {Object}\n */\n lastChild(object) {\n return this._node(object).lastChild;\n }\n\n /**\n * Returns the previous sibling of the given object.\n *\n * * `O(1)`\n *\n * @method previ