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

pyxis

v1.1.1

Published

associative container

Downloads

1

Readme

pyxis.ts

An associative container for TypeScript

  1. Associative: values are referenced by key and not by position.

  2. Unique keys: each key in container is unique.

  3. Ordered: all keys are kept in order.

  4. Mapped: each entry associates a key to a mapped value.

  1. empty : test whether container is empty or not.

  2. clear : empties container

  3. size : returns number of entries in container.

  4. locate(key) : locates value of entry by key.

  5. insert(key, value) : inserts a unique key into container in sorted order.

  6. remove(key) : removes key and its associated value from the container.

  7. enum : enumerate the keys in the container

Install:

npm install pyxis

Compile:

tsc file-name.ts --target es5

Run:

node file-name.js
import Container from './node_modules/pyxis/index'

// create new container
let container = new Container()

// insert key-value pairs into container
// key and value can be of any type
container.insert(1, "foo")
container.insert(2, "bar")
container.insert(3, "baz")

// enumerate each key in the container
container.enum().forEach(el => {
    console.log(el.key, el.value)
    /*
        1 'foo'
        2 'bar'
        3 'baz'
    */
})

// find item in container with key of "3"
console.log(container.locate(3)) // baz

// get the size of the container
console.log(container.size()) // 3

// remove item from container with key of "1"
container.remove(1)

console.log(container.size()) // 2

// test if container is empty
if(!container.empty()) console.log('contains stuff') // contains stuff

// clear all contents of container
container.clear()

console.log(container.size()) // 0