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

drawerjs

v1.0.5

Published

Drawer Js can store/set any kind of data and pick/get that data at every file of your project. Assign any thing and get any where in application as a single context/state.

Downloads

22

Readme

Drawer JS

Build Status npm version Coverage Status contributions welcome HitCount downloads

Drawer is like where you store and pick things. Drawer Js can store/set any kind of data and pick/get that data at every file of your project. Assign any thing and get any where in application as a single context/state. just import and you will get every thing you assigned. can also be used as inmemory cache or storing react-router history object to push to new page from any where.


Basic useful feature list:

  • Store any kind of data in memory.
  • Get data at any place/file of application and update.
  • Can get as a clone so you can use it without worry about reference variable update.
  • Can check if key or data exist already or not.
  • Get all or clear all existing data at once.

installation

npm install drawerjs --save

Class Functions

Functions List:

set({key: value}) // update/set the value against given key
get(key) // will return value with same reference address
getAll()
getClone() // will return the value with change reference address
clear(key)
clearAll()
isExist(key) // return true if data exist
isKeyExist(key) // return true if key exist even with null data

Params Types:

| Param | Type | Required | Default | | ------- | ---- | --- | --- | | key | unique String | Required | undefined | | data | Any | Required | undefined |

Coding Example File A

import drawer from 'drawerjs';
// for Ecma5 it imports like below
// var drawerjs = require("drawerjs").default;

drawer.set({ key1: { temp: "mydata" } });
drawer.set({ key2: { temp: "mydata2" } });
drawer.set({ key3: null });

Coding Example File B

import drawer from 'drawerjs';
// for Ecma5 it imports like below
// var drawerjs = require("drawerjs").default;

drawer.get("key1"); // { temp: "mydata" }
drawer.getClone("key1"); // { temp: "mydata" }
drawer.getAll(); // { key1: { temp: "mydata" }, key2: { temp: "mydata2" }, key3: null }
drawer.clear("key1"); // { key2: { temp: "mydata2" }, key3: null }
drawer.isExist("key1"); // false
drawer.isExist("key2"); // true
drawer.isExist("key3"); // false
drawer.isKeyExist("key1"); // false
drawer.isKeyExist("key2"); // true
drawer.isKeyExist("key3"); // true
drawer.clearAll(); // null

Unit Tests Unit test provided with 100% Coverage

npm run test

License

MIT