{"_id":"@anchor-logoot/dtst-js","_rev":"2-249f9b8f78ba90119f152d7076cc22d3","name":"@anchor-logoot/dtst-js","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@anchor-logoot/dtst-js","version":"0.1.0","description":"Differential Ternary Search Tree in TypeScript.","main":"lib/index.js","types":"lib/src/index.d.ts","typings":"lib/src/index.d.ts","author":{"name":"Nathan Pennie","email":"kb1rd@kb1rd.net"},"license":"LGPL-3.0-or-later","scripts":{"check-types":"tsc --noEmit","check-types:watch":"yarn run type-check -- --watch","build":"yarn run lint && yarn run build:types && yarn run build:js","build:types":"tsc --emitDeclarationOnly","build:docs":"typedoc --mode modules --out .jsdoc src/","build:js":"babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline","lint":"eslint src/*","test":"mocha --require ./test/babel-register.js --colors ./test/*.spec.ts","test:watch":"mocha --require ./test/babel-register.js --colors -w ./test/*.spec.ts","test:cover":"cross-env NODE_ENV=test nyc mocha --require ./test/babel-register.js --require source-map-support/register --recursive --colors ./test/*.spec.ts"},"devDependencies":{"@babel/cli":"^7.8.3","@babel/core":"^7.8.3","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/preset-env":"^7.8.3","@babel/preset-typescript":"^7.8.3","@babel/register":"^7.10.5","@istanbuljs/nyc-config-typescript":"^1.0.1","@types/chai":"^4.2.11","@types/mocha":"^8.0.0","@typescript-eslint/eslint-plugin":"^3.7.0","@typescript-eslint/parser":"^3.7.0","babel-eslint":"^10.1.0","babel-plugin-istanbul":"^6.0.0","chai":"^4.2.0","cross-env":"^7.0.2","eslint":"^7.5.0","eslint-config-prettier":"^6.11.0","eslint-loader":"^4.0.2","eslint-plugin-prettier":"^3.1.4","mocha":"^8.0.1","nyc":"^15.1.0","prettier":"^2.0.5","typedoc":"^0.19.2","typescript":"^3.7.5"},"gitHead":"a2b3905d9a52f90b354350a7acfd3e196054152f","_id":"@anchor-logoot/dtst-js@0.1.0","_nodeVersion":"12.20.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-siC3cwx6ip1oFYitNi2AZL92+E90FAtPjdP5koFxYURwo7UTHill4qealJ4bi6Dvsr4OwaBHb1Th6opVCkSetw==","shasum":"e9b072c616248ffe88b45a2c5ef1d2a22561a3d6","tarball":"https://registry.npmjs.org/@anchor-logoot/dtst-js/-/dtst-js-0.1.0.tgz","fileCount":18,"unpackedSize":249947,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf9IAtCRA9TVsSAnZWagAAVggP/04WEFAlbfT8D3Jq+Kd4\n09ZZ2iwzTlJHU6PYj53Hfu97xyiECollZx83UTbLesG7jjUGtkNXLueg/Ti+\nhhrSE+OGg49FkdhGD0g7cWwYuCuvAGzriAkK1HZv/YPAT9atDoo1VvMQMWTQ\nPUHJq27n4hBxE8m44b0L1HFQxrHFwg3MXj2If0MtENAlyrfbyatGdSzOl6gm\nDAaeD6KIWOimdingRjD4M6F+Kd5ZS+VR5MODnVhKogp01IlnyFAZ0KB3syJm\n+pF+eqaM5G6JZFjY9HXFCL1YFPLHiIYyhcTEsO008vUpu3L8IXIc4dxDIC5t\n0hQchU2WV9bfuEM3a3FcCsajIaI+bXLu6JbkEM+WHHnlR1HoKeYt5Dl07oQh\n+Jjyv457Tt1Lgo7z6zuAFNLMc1yBvhJVgsbQuWzsPxyL3i5leAc2v6qI7mpv\nTlQIBzCUd8h9e6RsqsW8eYVLbbLPxfnXKgJHl7TPLMS13Qn8K6tPZvYHo4H+\nGklzDrRpalRV+ZtOwmBiOMAe07LsdxGbpsDVv8eHOr5eBvdYn7yOfTmp81HB\nCpPaXKXtYd8HFaqqUBGYaYWWuZg5aPcL+rVd/GyHQYCz+GrniixL/rnHFM3y\ncjbmy5AVj3nNkKc5jvm0xWLohtS9yDX18Bb4keBe93q53xKcfx+oEovmSq6V\nbxRB\r\n=vSDJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjY7JeLuvzwyJVgxUD40t6RD4+fvlWlWzkGOj08S+5agIhAJA1F4jrts0J3QawLIyTX/xRIHtTBX+0PvlcB0sMjV4f"}]},"_npmUser":{"name":"kb1rd","email":"kb1rd@kb1rd.net"},"directories":{},"maintainers":[{"name":"kb1rd","email":"kb1rd@kb1rd.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dtst-js_0.1.0_1609859116611_0.7061711816787528"},"_hasShrinkwrap":false},"0.1.1":{"name":"@anchor-logoot/dtst-js","version":"0.1.1","description":"Differential Ternary Search Tree in TypeScript.","main":"lib/index.js","types":"lib/index.d.ts","typings":"lib/index.d.ts","author":{"name":"Nathan Pennie","email":"kb1rd@kb1rd.net"},"license":"LGPL-3.0-or-later","scripts":{"check-types":"tsc --noEmit","check-types:watch":"yarn run type-check -- --watch","build":"yarn run lint && yarn run build:types && yarn run build:js","build:types":"tsc --emitDeclarationOnly","build:docs":"typedoc --mode modules --out .jsdoc src/","build:js":"babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline","lint":"eslint src/*","test":"mocha --require ./test/babel-register.js --colors ./test/*.spec.ts","test:watch":"mocha --require ./test/babel-register.js --colors -w ./test/*.spec.ts","test:cover":"cross-env NODE_ENV=test nyc mocha --require ./test/babel-register.js --require source-map-support/register --recursive --colors ./test/*.spec.ts"},"devDependencies":{"@babel/cli":"^7.8.3","@babel/core":"^7.8.3","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/preset-env":"^7.8.3","@babel/preset-typescript":"^7.8.3","@babel/register":"^7.10.5","@istanbuljs/nyc-config-typescript":"^1.0.1","@types/chai":"^4.2.11","@types/mocha":"^8.0.0","@typescript-eslint/eslint-plugin":"^3.7.0","@typescript-eslint/parser":"^3.7.0","babel-eslint":"^10.1.0","babel-plugin-istanbul":"^6.0.0","chai":"^4.2.0","cross-env":"^7.0.2","eslint":"^7.5.0","eslint-config-prettier":"^6.11.0","eslint-loader":"^4.0.2","eslint-plugin-prettier":"^3.1.4","mocha":"^8.0.1","nyc":"^15.1.0","prettier":"^2.0.5","typedoc":"^0.19.2","typescript":"^3.7.5"},"gitHead":"66337bd634a6104e28254436f142f494ab5716a3","_id":"@anchor-logoot/dtst-js@0.1.1","_nodeVersion":"12.20.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-SrkrWijRdYXjMqYoiCT87gpZsX05JEAnDXUoHSDKnSASKzY86oPbzPPO5stx1MWFo1DGpiN+gQN8dpNB04pPeg==","shasum":"61763e9397a04f6ff8d24b27b3b6094b00141984","tarball":"https://registry.npmjs.org/@anchor-logoot/dtst-js/-/dtst-js-0.1.1.tgz","fileCount":18,"unpackedSize":249939,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf9MO0CRA9TVsSAnZWagAAJE4QAIboN+0Kew6F8TqaQVUM\nND6yo0cJrwDWTjc0A1UWjW9Rpb/UFW3QvPBbv/ZLwHtEuGRDWPx54o9a79rA\nhOlPPESJZmRwdS/rCKLEPcNtE6gmz1MXwSvfTkmd4RNzwxsLTsYmkDYYRx3P\nCm+pLKKgMWb6ou8mX7vfnsVLZqW82rEvAzmM2rcdCeuA9yHsizkpQ6zZ73/r\n3khoCdbJJaLFztGRHjkGBrm4mbo8sIrhc6dpE+QXmjIzw0wbYNQ9f4oKYCA9\nrDbcZ1V+4260eMc9bSHvCjBSO51y4o6DKaHE/EYfQ1obeZ571x99y8BZVJKF\n14uWcQjnhxJFDii9HP5rBVeke+kxsGNt2s7H/h21dQhVHyElfppEaarrzfIl\nFbi9r3eI7xGznlhitnOkYdV9Ojtm1F1tq5weGm6QnspLzHjWuAzJGmQAaGfp\nAfqgWmPYB26vkjBXxERuNQYuEfbABpK8dqRIxa4UzGdemqxwKBs6qAHWfDGJ\nhf40gKMC6nng8RkjRL469mzgLUYu21TAFFXlGQuh3VQYxaytNFIWsfU+G0pq\nlKNX4dgAPbjsUPcJXfx4FaA4gnAB0eu6umtkxZllcck7WngT0cAm0DBBCK/w\nK3vNsRHnXFcWC7cW0GqDbtBJ19UmOHlLjHj8xS+X6nby0jM5GO0E7Zb6YSci\nCIEO\r\n=Iyrp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCljQssWWF9IT0KcNeNdIuq9J1/eknBDgv0ouDzFH90kgIgaKvQuRk7Q/AvwxwRrIWpLC47YIo6wvucLxp7ZIcyAjQ="}]},"_npmUser":{"name":"kb1rd","email":"kb1rd@kb1rd.net"},"directories":{},"maintainers":[{"name":"kb1rd","email":"kb1rd@kb1rd.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dtst-js_0.1.1_1609876403662_0.28217159927879876"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-05T15:05:16.386Z","0.1.0":"2021-01-05T15:05:16.745Z","modified":"2022-04-04T13:56:53.063Z","0.1.1":"2021-01-05T19:53:23.842Z"},"maintainers":[{"name":"kb1rd","email":"kb1rd@kb1rd.net"}],"description":"Differential Ternary Search Tree in TypeScript.","author":{"name":"Nathan Pennie","email":"kb1rd@kb1rd.net"},"license":"LGPL-3.0-or-later","readme":"# dtst-js\n\n**D**ifferential **T**ernary **S**earch **T**ree **JS**\n\n## 🚧 Work In Progress 🚧\n\nCurrently, there is no tree balancing done, no optimizations have been considered, and documentation is relatively poor.\nThis is because this package was pulled out of the code base of `logootish-js` and I haven't had time to go through and\nmake proper examples.\n\n## What is it?\n\n**TL;DR** it's an algorithm for storing, finding, and quickly applying offsets to a number for an ordered list of nodes.\n\nThis is a custom algorithm derived from a binary search tree. It was designed to model text sequences that may require\nnodes to be shifted over in bulk. Let's assume that each node in a traditional BST has a numeric position. Shifting\nmany of these positions is quite expensive since one would need to iterate over every node after the position being\nshifted. Instead, it would be quite a bit easier if we could make positions of nodes relative to one another. This is\nexactly what this algorithm does. Each node *must* have an integer `value`. The primary method of sorting nodes is by\ntheir value. Once added to the tree, a node's value may be computed by using the `absolute_value` getter.\n\nHowever, note that I'm calling this a differential *ternary* search tree, not binary. As it turns out, if you have nodes\nthat are being shifted around that may potentially have the same value, it's quite easy to corrupt the tree. To make\nthis easier, instead of placing nodes with equal value to a parent in the left side of the tree, an array is added to\neach node to store nodes with the same value. This means that all nodes to the left of a node have a lower value and\nnodes to the right have a greater value. However, in the case of zero length nodes, it is often desireable to keep them\nin order so that they stay in order when you offset them. In other words, if you have five nodes of zero length and you\noffset the middle node, you often want to keep these five nodes in order so that you know which three nodes will be\noffset as a result. This is done by defining a `preferential_cmp` method in the abstract class. This will be used to\ndetermine order when nodes have the same value. **This must return the same order as `value` in all cases.** You also\n**can just set it to return 0 all the time if you don't plan on having nodes with the same value.**\n\nSo, there you have it. To add custom data, just extend the `DTstNode` class (the type parameter is just the type of your\nnew class) and start adding your nodes to a `DTst` (the type paramater is just the type of your nodes).\n**Note that nodes can only be added to a single `DTst`.**\n\n## Docs and examples\n\nFor now, there's just the JSDoc. Sorry.\n\n## Development\n\n```bash\n\n# Install deps\nyarn\n\n# Check types\nyarn run check-types\n\n# Just lint\nyarn run lint\n\n# Build for production (and lint)\nyarn run build\n\n# Build jsdoc\nyarn run build:docs\n\n# Test\nyarn run test\n\n# Test with auto reloads\nyarn run test:watch\n\n# Get test coverage\nyarn run test:cover\n\n```\n","readmeFilename":"README.md"}