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

z-cookies

v1.0.2

Published

Your cookies made easy

Downloads

4

Readme

Banner

Z-Cookies

npm version

What's that ??

Nowadays, a lot of websites are using cookies. They set, get or delete their cookies sometimes with an heavy jQuery plugin, or sometimes with some noobie home made scripts...

Here is our solution: A really lightweight vanilla JS Module to handle your cookies.

And it is now available on npm!!

It is called Z-cookies, and here is how it works :

How does it work

This is a module design pattern. When added to your application, nothing more than calling its methodes is required

Get

With this method, you will be able to get the browser cookies data:

Get a specific cookie

var myCookie = ZCookies.get("numberOne"); // myCookie = "foo"

Get multiple cookies

var myCookies = ZCookies.get("numberOne", "numberTwo"); //  myCookies = {"numberOne": "foo", "numberTwo" : "bar"}

Get all the cookies as an object

var myCookies = ZCookies.get(); // myCookies = {"numberOne": "foo", "numberTwo" : "bar"}

Set / Update

Here if the cookie already exists, it will be updated, otherwise it is created.

ZCookies.set("numberThree", "Hello, World!");

Expiration date

Instead of providing some ununderstandable timestamps, we chose an easyer solution : providing a simple object with the days, mins and/or hours set. You can also provide a number if you just need to set the expiration date in term of days.

It will be automatically converted so that the browser understands well what you meant.

ZCookies.set("numberFour", "Where is bryan?", {days: 1, hours: 12, mins: 30});
//Or you can just set the usefull values
ZCookies.set("numberFive", "Where is bryan?", {days: 1, mins: 30});
ZCookies.set("numberSix", "Where is bryan?", 2);

Delete

ZCookies.delete("numberThree"); // now numberThree cookie does not exist anymore.

BONUS

You can chain ZCookies set and delete methodes.

The get method can be added at the end of the chain, it is meant to return a value.

ZCookies.set("Chaining", "Is").set("A", "realy").set("Awesome", "Feature").delete("A").get(); // {"Chaining": "Is", "Awesome": "Feature"}

Contribute

This is an Open-Source project created by ZeZen & Pacejz.

You can contribute, fork, pull request, issue, etc... We will try to answere to each of you :)

dev server (facultative)

There is a simple configuration file that is meant to be used with lite-server

npm i

With this server, you'll be able to watch changes on the files and refresh your browser automatically. If you open the given url on multiple devices, it will be synchronised too.

To start the server, simply type

npm run dev

Warning! The minified version of the js is not generated automatically, you'll have to use some other tools to do that...

License

MIT