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

@sammachin/node-red-lookup

v1.0.0

Published

Node-RED node that maps the value of one message field to another using a lookup table, with a configurable default for no match

Readme

@sammachin/node-red-lookup

A single Node-RED node that maps the value of one message field to another using a lookup table.

You choose a source field to read and a target field to write (they can be the same field), give it a list of from → to pairs, and decide what happens when a value isn't in the table.

Example

Source msg.payload.from, target msg.payload.to, with pairs:

123 → 456
+441234 → +445678

An incoming msg.payload.from = "123" produces msg.payload.to = "456".

Configuration

| Field | Description | |-------------|-----------------------------------------------------------------------------------------------| | Source | The field to read. A msg property (default payload), or flow / global context. | | Target | The field to write on a match. Same choices as source; set it equal to the source to rewrite in place. | | Pairs | The lookup table. The left side (from) is matched by value; the right side (to) is a typed input, so it can be a string, number, boolean, JSON, a message / context property, or a JSONata expression. | | No match| What to do when the source value isn't in the table (see below). |

Matching

Matching is by value as a string, so the number 123 and the string "123" both match a pair keyed 123. A missing source field (undefined) never matches. If two rows share the same from value, the first one wins.

No match

  • Pass through unchanged — the target is left alone and the message is sent on.
  • Set a default value — the target is set to a fixed value, then sent on.
  • Send to 2nd output — the node grows a second output; matched messages leave the first output, unmatched ones leave the second, so you can handle them separately.

Develop

npm install
npm test

The node lives in src/nodes/lookup.js (runtime) and src/nodes/lookup.html (editor). Tests use node-red-node-test-helper.

Licence

MIT