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

node-red-node-data-generator

v1.0.2

Published

A Node-RED node to create a string of dummy data values from a template. Useful for test-cases.

Downloads

223

Readme

node-red-node-web-data-generator

A Node-RED node to create dummy data values from a template. Useful for building test-cases.

Install

Either use the Manage Palette option in the Node-RED Editor menu, or run the following command in your Node-RED user directory - typically ~/.node-red

    npm i node-red-node-data-generator

Usage

Creates dummy data based on a handlebars-style template.

Uses the dummy-json module, which can create rich sets of dummy data for testing or other uses.

It will build a string, or a parsed JSON object, creating values based on the helper names below:

title, firstName, lastName, company, domain, tld, email,
street, city, country, countryCode, zipcode, postcode,
lat, long, phone "+xx (x) xxxx xxx xxx", color, hexColor, guid,
ipv4, ipv6, lorem nn, date, time,
lowercase (helper), uppercase (helper), int, float, boolean

Multiple values can be generated by use of the repeat syntax.

In addition any properties passed in on the msg object can also be used - for example {{payload}}.

Finally msg.seed can be used to preset the pseudo-random seed to ensure repeatability across calls.

Example

The example flow below produces a JSON string which is then converted into an object, for example:

{
    "name": "Theo Cumbie",
    "work": "CoreXTS",
    "email": "[email protected]",
    "address": "83 Sherman Road",
    "country": "Angola",
    "text": "Sagittis orci elementum e vel scelerisque. Amet ac tristique lectus. Morbi e suscipit scelerisque auctor curabitur velit metus gravida quis."
}

Example flow

[{"id":"325b6a4a.cf1706","type":"inject","z":"4affede3.af6f44","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":110,"y":300,"wires":[["9d14acc0.c8d9d"]]},{"id":"96c9a04e.35232","type":"debug","z":"4affede3.af6f44","name":"","active":true,"console":"false","complete":"false","x":513,"y":300,"wires":[]},{"id":"9d14acc0.c8d9d","type":"data-generator","z":"4affede3.af6f44","name":"","field":"payload","fieldType":"msg","syntax":"json","template":"{\n "name": "{{firstName}} {{lastName}}",\n "work": "{{company}}",\n "email": "{{email}}",\n "address": "{{int 1 100}} {{street}}",\n "country": "{{country}}",\n "countryCode": "{{countryCode}}",\n "text":"{{lorem 20}}"\n}","x":280,"y":300,"wires":[["96c9a04e.35232"]]}]