npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sangja

v0.1.1

Published

JavaScript data structures library

Downloads

3

Readme

sangja

Sangja is javaScript data structures library.
Implemented data structures provides interfaces similar to array, which is the native data structure of javascript.

Installation

npm install sangja

Implemented Data Structures

Document

https://chacham.github.io/sangja/

Usage

const sangja = require('sangja');

let some = new sangja.Optional(123);
let none = new sangja.Optional();
some.getOrElse(22); // 123
none.getOrElse(22); // 22

let stack = new sangja.Stack();
stack.push(123);
stack.pop(); // 123

let queue = new sangja.Queue();
queue.enqueue(456);
queue.dequeue() // 456

let list = new sangja.LinkedList();
list.addLast(456);
list.addFirst(123);
list.addLast(789);
list.get(0); // 123
list.get(1); // 456
list.getLast() // 789

let heap = new sangja.Heap();
heap.add(123);
heap.pop(); // 123

let bst = new sangja.BinarySearchTree();
bst.addAll([3, 8, 2, 6, 4]);
bst.includes(8); // true
let otherBst = bst.map(v => {value: v}, { key: item => item.value });

Method Summary Table

Linear Data Structures

Methods | Optional | Stack | Queue | LinkedList --- | --- | --- | --- | --- Implemented | O | O | O | O Constructor | new Optional([value]) | new Stack([iterable]) | new Queue([iterable]) | new LinkedList([iterable]) Add | - | push(item) | enqueue(item) | add([index,]item), addFirst(item), addLast(item) Add All | - | pushAll(iterable) | enqueueAll(iterable) | addAll([index,]iterable), addAllFirst(iterable), addAllLast(iterable) Read | get(), getOrElse(item) | top() | peek() | get(index), getFitst(), getLast() Update | - | - | - | set(index, value) Delete with position | - | pop() | dequeue() | pop([i]), popFirst(), popLast(), removeAt(i) Delete with value | - | - | - | remove(v), removeFirst(v), removeLast(v), removeAll(v) Delete with predicate | - | - | - | removeMatch(f), removeMatchFirst(f), removeMatchLast(f), removeMatchAll(f) Delete All | - | clear() | clear() | clear() | - find(f) | - | - | - | O findOptional(f) | - | - | - | - forEach(f) | O | O | O | O map(f) | O | O | O | O flatMap(f) | O | O | O | O filter(f) | O | O | O | O size() | O | O | O | O isEmpty() | O | O | O | O reversed() | - | O | O | O some(f) | O | O | O | O every(f) | O | O | O | O includes(v) | O | O | O | O [Symbol.iterator] | O | O | O | O

Tree Data Structures

Methods | Heap | BinarySearchTree --- | --- | --- Implemented | O | O Constructor | new Heap([iterable][,options]) | new BinarySearchTree([iterable][,options]) Add | add(item) | add(item) Add All | addAll(iterable) | addAll(iterable) Read | peek() | peek() Update | - | - Delete | pop() | pop() Delete with value | - | remove(v) Delete with predicate | - | removeMatch(f) Delete All | clear() | clear() find(f) | O | O findOptional(f) | - | - forEach(f) | O | O map(f[,options]) | O | O flatMap(f[,options]) | O | O filter(f[,options]) | O | O size() | O | O isEmpty() | O | O reversed() | O | O some(f) | O | O every(f) | O | O includes(v) | O | O [Symbol.iterator] | O | O inorder([f]) | - | O preorder([f]) | - | O postorder([f]) | - | O breadthFirst([f]) | O | O

Contributing

Sangja is open to any contributions made by the community.
Reporting error, adding test cases, correcting typo, correcting inconsistent comments, fixing awkward sentence, and so on... are all good.

Contact

[email protected]

License

Sangja is released under MIT License