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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cookiejs.js

v1.0.2

Published

Set, get and remove cookies.

Readme

cookiejs v1.0.1 Build Status Scrutinizer Code Quality Downloads over NPM per month

Set, get and remove cookies.

UMD and ES6 modules

We ship cookiejs.js primarly as a UMD module but there is also an ES6 module included.

using the ES6 module

import cookiejs from 'cookiejs.js'; //should import cookiejs.es.js
cookiejs.set('testcookie', 'testvalue');

Getting started

There is more than one way to use cookiejs.js inside your project. I prefer using npm for dependency management.

If you haven't used npm (Node Package manager) before, be sure to check out the Getting Started guide, as it explains how to install and use npm. Once you're familiar with that process, you may install the cookiejs.js module with this command inside your project:

npm install cookiejs.js --save-dev

Once the module has been installed, you may integrate that file into your build process (e.g concatenating and uglifying your JS with Grunt or whatever) since the --save-dev option is meant for development only.

Available functions inside cookiejs.js

cookiejs.set(sCookieName, sValue, oAttributes)

Sets a cookie.

// make sure cookiejs.js is already available when this code runs
cookiejs.set(
  // name of the cookie
  // default: undefined
  // required
  'captainObvious',
  // value of the cookie
  // default: ''
  'Thank you Captain Obvious, you just saved my life.',
  {
    // specifies allowed hosts to receive the cookie
    // default: the host of the current document location
    domain: '.eric-zieger.de',
    // indicates a URL path that must exist in the requested URL
    // default: '/',
    path: '/the-adventures-of-captain-obvious/',
    // cookie is deleted when the client shuts down (session-cookie) or when the expire date is reached
    // default: session-cookie
    expires: new Date('2040-01-01').toUTCString(),
    // cookie expires after a specific length of time in seconds
    // default: undefined
    'max-age': '3600',
    // cookie is only sent to the server with a encrypted request over the HTTPS protocol
    // default: false
    secure: true
  }
);

cookiejs.get(sCookieName)

Get the value of a cookie.

// make sure cookiejs.js is already available when this code runs

cookiejs.get('captainObvious');

// returns 'Thank you Captain Obvious, you just saved my life.'

cookiejs.remove(sCookieName, oAttributes)

Removes a cookie by overwriting the expires date. When a custom domain and/or path atrribute is used you have to hand them as object into this function. Else the cookie will not get removed.

// make sure cookiejs.js is already available when this code runs

cookiejs.remove('captainObvious', {
  domain: '.eric-zieger.de',
  path: '/the-adventures-of-captain-obvious/'
});