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

querystringme

v1.0.9

Published

Library to manage querystring parameters

Downloads

4

Readme

querystringme

Library to process querystring parameters

  1. Install
npm install querystringme
  1. Usage
var querquerystringmeyme = require('querystringme');

// You can load inital parameters with load()
querystringme.load({
    localStorage: true
});

querystringme.getParameters();
querystringme.getParameter('foo', { force: true });
querystringme.updateParameters({ foo: 'bar', other: 'boo' }, { localStorage: true });
  1. Development
npm run dev

This watches files and compiles them

  1. Run tests
npm run dev
npm start // or node server.js
npm test

npm run dev should be running to watch and recompile files.

  1. Options

All methods receive at least one optional object that can have the following options:

  • force: boolean. When true parses URL every time instead of using stored values. Default: false.
  • updateUrl: boolean. When true updates browser's URL after each parameter change. Default: true.
  • localStorage: boolean. When true uses localStorage to store parameters and to restore them when the page is loaded. URL parameters overwrite stored values. Default: false.
  • defaultValues: object. Key-value object to specify default values. Those values are overwritten by browser's URL. If these values are not present in URL they are added. Default: {}.
    • default: default value.
    • validator: function to validate value. Default value is assigned when false is returned.
querystringme.load({ 
    defaultValues: {
        second: { default: '1', validator: (v) => parseInt(v) !== 0 },
        third: { default: '2', validator: (v) => v === null },
        fourth: { default: '4', validator: (v) => v !== null },
    } 
});
  1. List of methods
  • load(options): overwrites default options. Process URL and localStorage parameters and updates the browser URL. The parameter options is optional.
  • getParameters(options): Return all the processed parameters after processing browser URL and localStorage. Browser's URL parameters overwrite localStorage ones. The parameter options is optional.
  • getParameter(key, options): Returns the parameter with name key. The parameter options is optional.
  • updateParameters(values, options): Receives an object with the parameters to update and sets those values. It updates the browser's URL and localStorage when enabled. The parameter options is optional.