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

@allnulled/url-command

v1.0.1

Published

Call functions through URL + Object.

Readme

url-command

Use URLs and Objects to call functions.

Install

npm i -s url-command

Import

In node.js:

require("@allnulled/url-command");

In html:

<script src="node_modules/@allnulled/url-command/url-command.js"></script>

API

1. Create an instance

Use URLCommand.from(object) to create an instance.

2. Run commands

Then use urlcommand.run(text) to run commands by URL.

It will call the function passing 1 object only, containing the parameters provided on run.

3. Run functions

You can use the parameter ?...&argumentsOrder=a,b,c,d to call functions using all the parameters allowed by JavaScript.

It will call the function spreading the specified properties in the specified order.

4. Pass data too

Apart from the querystring parameters, you can pass data, like objects and functions and whatever (no strings, I mean), with a second parameter on the run method.

Usage

const object = {
    command: {
        hello({ name }): () => console.log("hello, " + name)
    }
};
URLCommand.from(object).run("/command/hello?name=world");

Test

require(__dirname + "/url-command.js")

describe("URLCommand API Test", function (it) {
  // Ejemplo de uso
  const handlers = {
    sum: ({ a, b }) => parseFloat(a) + parseFloat(b),
    maths: {
      multiply: ({ a, b }) => parseFloat(a) * parseFloat(b),
      sumatory: (...args) => {
        let out = 0;
        for(let index=0; index<args.length; index++) {
          const arg = args[index];
          out += parseFloat(arg);
        }
        return out;
      }
    },
    commands: {
      hello: (urlParams) => {
        const { name } = urlParams;
        const msg = "hello, " + name;
        return msg;
      },
      message(emitter, receiver, contents) {
        const msg = `${emitter} says to ${receiver}: "${contents}"`;
        return msg;
      },
      bye: (name) => {
        const msg = "bye, " + name;
        return msg;
      },
    }
  };

  const urls = [
    ["/commands/hello?name=world", "hello, world"],
    ["/sum?a=10&b=2", 12],
    ["/maths/multiply?a=10&b=2", 20],
    ["/maths/sumatory?a=40&b=7&c=2&d=1&argumentsOrder=a,b,c,d", 50],
    ["/commands/message?a=origin&b=destination&c=This is a request&argumentsOrder=a,b,c", 'origin says to destination: "This is a request"'],
    ["/commands/bye?argumentsOrder=a", 'bye, Emily', { a: "Emily" }],
  ];

  for (let index = 0; index < urls.length; index++) {
    const [url, result, args = {}] = urls[index];
    it("Can run: " + url, function () {
      const output = URLCommand.from(handlers).run(url, args);
      ensure({ output }).is(result);
    });
  }
});