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 🙏

© 2025 – Pkg Stats / Ryan Hefner

red-contrib-miniscule-transformer

v1.0.0

Published

TP2 IOT application - ISIMM

Readme

node-red-contrib-miniscule-transformer

A lightweight Node-RED node that lets you run a small JavaScript function as part of a flow.

This package contains the Node-RED node implementation files (node.js, node.html) and the package metadata (package.json). Use this node to execute custom JavaScript logic safely inside a Node-RED flow.

Features

  • Add a configurable function to your Node-RED flows.
  • Access msg, flow, and global context from the function.
  • Return messages to downstream nodes using return or node.send().
  • Small and easy to embed inside Node-RED.

Note: This node executes JavaScript code you provide. Be careful when running untrusted code — see the Security section.

Installation

From the Node-RED user directory (usually ~/.node-red):

# Install from npm (if published)
npm install node-red-contrib-miniscule-transformer

# Or install locally by copying this package directory into ~/.node-red/node_modules
# (useful during development)
# from this repo root:
npm link
# then in ~/.node-red
npm link node-red-contrib-miniscule-transformer

After installation, restart Node-RED. The node will appear in the palette under a category named "taiponrock" (or similar based on the node.html configuration).

Usage

  1. Drag the TaiponRock node into a flow.
  2. Double-click to open the editor.
  3. Enter a JavaScript function body into the Function field. You can read and modify msg.
  4. Wire inputs and outputs as usual.

Example function body:

// simple example: add a timestamp and forward the message
msg.payload = msg.payload || {};
msg.payload.processedAt = new Date().toISOString();
return msg;

Inside the function you can use:

  • msg — the message object.
  • flow.get('key'), flow.set('key', value) — flow-scoped context.
  • global.get('key'), global.set('key', value) — global context.
  • node.warn(...), node.error(...) — to log from the node.

If you prefer asynchronous work, you can return null and use node.send() inside the function body if the implementation supports it (see node's editor help in the palette).

Example Flow

A minimal example flow that sends a string to the node and logs the output:

[
  {
    "id": "fa3b1f1b.000001",
    "type": "inject",
    "z": "flow1",
    "name": "trigger",
    "props": [{ "p": "payload" }],
    "payload": "hello",
    "payloadType": "str",
    "repeat": "",
    "crontab": "",
    "once": true,
    "onceDelay": 0.1,
    "wires": [["taiponrock-node"]]
  },
  {
    "id": "taiponrock-node",
    "type": "taiponrock",
    "z": "flow1",
    "name": "process",
    "func": "msg.payload = msg.payload + ' world';\nreturn msg;",
    "outputs": 1,
    "wires": [["debug1"]]
  },
  {
    "id": "debug1",
    "type": "debug",
    "z": "flow1",
    "name": "debug",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "wires": []
  }
]

Import this JSON into Node-RED (menu -> Import -> Clipboard) and deploy.

Configuration Options

The node editor exposes the following fields (names may vary depending on node.html):

  • Name — optional node name shown in the flow.
  • Function — the JavaScript code to execute. This should be a function body that operates on msg and returns msg (or an array of messages for multiple outputs).
  • Outputs — how many outputs the node has.

Refer to the node.html source in this repository for the exact property names and UI elements.

Security

This node runs arbitrary JavaScript provided by the user. That means:

  • Never paste or run code from untrusted sources.
  • Do not use this node to process messages that originate from untrusted users or external inputs without validation.
  • Avoid importing native modules or calling external processes from inside the function unless you control the function content.

If you need sandboxing or strict security guarantees, consider using Node-RED's built-in Function node or a dedicated sandboxing solution.

Development

The repository contains these important files:

  • node.js — node runtime implementation.
  • node.html — node editor UI and configuration used by Node-RED.
  • package.json — package metadata and dependencies.

To develop locally:

# from the project root
npm install
npm link
# in your Node-RED userDir (~/.node-red)
npm link node-red-contrib-miniscule-transformer
# restart Node-RED and test your node

Run any available tests or linters you add to the package — none are included by default.

Publishing

If you plan to publish to npm:

  1. Update package.json with a unique package name (e.g. node-red-contrib-miniscule-transformer).
  2. Ensure keywords contains node-red and node-red-node to improve discoverability.
  3. Run npm publish from the repository root (you must be logged in with npm login).

Refer to the Node-RED documentation for publishing nodes: https://nodered.org/docs/creating-nodes/packaging

Troubleshooting

  • Node does not appear: make sure you installed the package into your Node-RED user directory (~/.node-red/node_modules) and restarted Node-RED.
  • Errors in the function: check the Node-RED log (console) for stack traces. Use node.warn() inside your function to debug.

Contributing

Contributions welcome. Open an issue or submit a PR with clear changes and tests if possible.

License

See the LICENSE file in this repository for license details.


If you'd like, I can also:

  • Generate a short example flow file in the repo (JSON) you can import into Node-RED.
  • Add a quick developer script to watch and reload the node in a local Node-RED instance.

Tell me which of those you'd like and I'll add it.