dsa_tools
v1.0.1
Published
A collection of data structures and utilities for JavaScript. - Stack - Is implemented using a Doubly-Linked List. - Supports the following operations in O(1) Time - push() - pop() - peek() - get_length() -
Downloads
4
Readme
dsa_tools
A collection of data structures and utilities for JavaScript.
- Stack
- Is implemented using a Doubly-Linked List.
- Supports the following operations in O(1) Time
- push()
- pop()
- peek()
- get_length()
- Deque
- Is implemented using a Doubly-Linked List.
- Supports the following operations in O(1) Time, in addition to those supported by Stack
- push_left()
- shift()
- peek_left()
- range()
- Works exactly like Python's range() function.
- memoize(fn)
- returns a cached/memoized version of fn
- properties
- find all properties of an object, including inherited properties
- protochain
- walks up the protochain
- protochain_soft
- same as protochain but only lists "name" properties on objects
Installation and Usage: Deno
cat <<\EOF > main.js
import {Deque, Stack, range, memoize, properties, protochain, protochain_soft} from "https://deno.land/x/dsa_tools/main.js" // "https://deno.land/x/[email protected]/main.js"
console.log(Deque, Stack, range, memoize, properties, protochain, protochain_soft)
EOF
deno run main.js
Installation and Usage: Node
mkdir my_project; cd my_project;
touch main.js
npm init -y; npm pkg set type="module";
npm pkg set scripts.test1="node main.js"
npm install dsa_tools
cat <<\EOF > main.js
import {Deque, Stack, range, memoize, properties, protochain, protochain_soft} from 'dsa_tools';
console.log(Deque, Stack, range, memoize, properties, protochain, protochain_soft);
EOF
node main.js
Misc publish output:
bash-3.2$ npm publish
npm notice
npm notice 📦 [email protected]
npm notice === Tarball Contents ===
npm notice 1.7kB README.md
npm notice 635B deque_unit_tests.js
npm notice 3.4kB deque.js
npm notice 101B main.js
npm notice 267B package.json
npm notice 1.2kB stack_unit_tests.js
npm notice 2.1kB stack.js
npm notice === Tarball Details ===
npm notice name: dsa_tools
npm notice version: 1.0.3
npm notice filename: dsa_tools-1.0.3.tgz
npm notice package size: 2.3 kB
npm notice unpacked size: 9.3 kB
npm notice shasum: d269ce05bd695c3e08a8ce60f4af421fede39711
npm notice integrity: sha512-wtKGLKKwQZZ68[...]3S894DLN3Apow==
npm notice total files: 7
npm notice
npm notice Publishing to https://registry.npmjs.org/ with tag latest and default access
+ [email protected]
bash-3.2$