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

param-handler

v1.1.52

Published

this is a library that allowes you to control query params location search

Downloads

25

Readme

The point of this project?

-it also allows you to change it without reloading the page. useful for virtual doms like (react, svelte, angular .. etc).

-it has callback when each variable changes (you have to use the same package for it to work).

-made with typescript!.

-it can return an object with these variable instead of a boaring string, for example: "?a=5&b=dad" => {a:5,b:"dad"}

How can i use this?

How to install:

Using npm:

-in your command promp type:

npm install param-handler

How can i test it:

Major Update changed the class name:

Its easy, you will need jsdom if you don't have a dom(plain nodejs),

first of all you need to import the package:

const _PH = require("param-handler"), 
    {PH} = require("param-handler") 
// or
import _PH, {PH} from "param-handler" 

// _PH and PH are the same thing

Then

let ph = new PH(window) // pass the window from the virtual dom

Then you can start using it!

How can i update a specific variable in the query search location:

Well its easy.

You can just use

ph.set("name_of_the_variable", "the_new_value")

How can i read a specific variable from the query search location:

You have two choises:

1- keep track of the changes of a specific variable:

ph.on("change", "name_of_the_variable", (new_value)=>{
    console.log(`name_of_the_variable has changed to ${new_value}!`)
})

note that you can use the second argument inside the callbackfunction to call "this".

2- Or you can just get the value of that specific variable:

ph.get("name_of_the_variable", "default_value", "reverse_if_boolean")

console.log(`
    name_of_the_variable has the value of 
    ${ph.get("name_of_the_variable")}`)

How can i get that fancy object thingy:

console.log(`the fancy object ${ph.params}`)

How can i check if a variable exists:

console.log(`does name_of_the_variable exists?`)

console.log(ph.exists("name_of_the_variable")?"YES":"no :(")