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

node-red-contrib-assert

v1.3.3

Published

A node-red node to check message property values.

Readme

node-red-contrib-assert

A Node Red node for asserting message properties within a flow.

This node will check all of the specified properties in a message or in the global or flow contexts to confirm that they meet the required format.

The assert node is configured with a list of rules. Each rule tests one specific property using either the usual comparison operators, ranges, regex, null, not null, boolean values, or type. Comparisons can be made against static values, other properties, and the property's previous value. The specification of the property to be checked is quite powerful, allowing the probing inside objects and arrays using Javascript descriptors.

For a message to pass through the assert node, all tests must pass. The first failing test is reported as an error which can be caught and processed out of band. Failed messages are dropped from the flow.

How to Use

Just insert the Assert node in your flow. Set the appropriate test conditions to check that the specified properties are valid when a message passes through the Assert node. Note that you can test global and flow properties as well. Any message that does not pass the tests will be dropped and an error reported.

The 'is within' test condition has an option to use the mean value of a sliding window of previous values. When you select 'mean', enter in the size of the window you would like to use.

Here is a sample flow that checks the msg.payload property value is less than 100:

Sample Flow

[{"id":"ede6fe04.eded3","type":"assert","z":"8b42e25d.61776","name":"Payload < 100",
"rules":[{"property":"payload","propertyType":"msg","type":"lt","value":"100","valueType":"num"}],
"x":442.5,"y":442,"wires":[["4fd55a87.740b74"]]},
{"id":"4fd55a87.740b74","type":"debug","z":"8b42e25d.61776","name":"","active":true,"console":"false",
"complete":"false","x":670.5,"y":445,"wires":[]},{"id":"5f32bb08.e7a17c","type":"inject","z":"8b42e25d.61776",
"name":"","topic":"","payload":"50","payloadType":"num","repeat":"","crontab":"","once":false,"x":172.5,
"y":440,"wires":[["ede6fe04.eded3"]]},{"id":"cb3d81c3.e0ecb8","type":"inject","z":"8b42e25d.61776","name":"","topic":"",
"payload":"150","payloadType":"num","repeat":"","crontab":"","once":false,"x":140.5,"y":513,
"wires":[["ede6fe04.eded3"]]},{"id":"ef019fc4.e98a2","type":"catch","z":"8b42e25d.61776",
"name":"Assert failed","scope":["ede6fe04.eded3"],"x":448.5,"y":522,"wires":[["ff38f898.9fb15"]]},
{"id":"ff38f898.9fb15","type":"debug","z":"8b42e25d.61776","name":"","active":true,"console":"false",
"complete":"error.message","x":697.5,"y":519,"wires":[]}]