mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Tidy datagenerator, random and smaz nodes
This commit is contained in:
parent
171f78ca5b
commit
e8a7af18d6
@ -7,16 +7,16 @@ data values from a template. Useful for building test-cases.
|
||||
Install
|
||||
-------
|
||||
|
||||
Run the following command in your Node-RED user directory - typically `~/.node-red`
|
||||
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 install node-red-node-data-generator
|
||||
npm i node-red-node-data-generator
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Creates dummy data based on a handlebars-style template.
|
||||
|
||||
Uses the <i><a href="https://github.com/webroo/dummy-json" target="_new">dummy-json</a></i>
|
||||
Uses the <i><a href="https://github.com/webroo/dummy-json/blob/master/README.md" target="_new">dummy-json</a></i>
|
||||
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
|
||||
|
@ -27,12 +27,12 @@
|
||||
|
||||
<script type="text/x-red" data-help-name="data-generator">
|
||||
<p>Creates dummy data strings based on a handlebars-style template.</p>
|
||||
<p>Uses the <i><a href="https://github.com/webroo/dummy-json" target="_new">dummy-json</a></i>
|
||||
<p>Uses the <i><a href="https://github.com/webroo/dummy-json/blob/master/README.md" target="_new">dummy-json</a></i>
|
||||
module, which can create rich sets of dummy data for testing or other uses.</p>
|
||||
<p>Will build a string or a parsed JSON object, creating values based on the helper names below:
|
||||
<pre style="word-break:normal">title, firstName, lastName, company, domain, tld, email, street, city, country, countryCode, zipcode, postcode, lat, long, phone, color, hexColor, guid, ipv4, ipv6, lorem [nn], date, time, lowercase, uppercase, int, float, boolean</pre>
|
||||
<p>Multiple values can be generated by use of the <i>repeat</i> syntax.</p>
|
||||
<p>In addition any properties passed in on <code>msg</code> can also be used - for example {{payload}}.</p>
|
||||
<p>In addition any properties passed in on <code>msg</code> can also be used - for example <code>{{payload}}</code>.</p>
|
||||
<p>Finally <code>msg.seed</code> can be used to preset the pseudo-random seed to ensure repeatability across calls.</p>
|
||||
</script>
|
||||
|
||||
@ -56,6 +56,7 @@
|
||||
label: function() {
|
||||
return this.name || "data generator";
|
||||
},
|
||||
outputLabels: function() { return this.syntax === "json" ? "object" : "string"; },
|
||||
oneditprepare: function() {
|
||||
var that = this;
|
||||
if (!this.fieldType) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name" : "node-red-node-data-generator",
|
||||
"version" : "0.0.5",
|
||||
"version" : "0.1.0",
|
||||
"description" : "A Node-RED node to create a string of dummy data values from a template. Useful for test-cases.",
|
||||
"dependencies" : {
|
||||
"dummy-json": "1.*"
|
||||
"dummy-json": "^2.0.0"
|
||||
},
|
||||
"repository" : {
|
||||
"type":"git",
|
||||
|
@ -6,20 +6,20 @@ A <a href="http://nodered.org" target="_new">Node-RED</a> node that when trigger
|
||||
Install
|
||||
-------
|
||||
|
||||
Run the following command in your Node-RED user directory - typically `~/.node-red`
|
||||
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-random
|
||||
|
||||
npm install node-red-node-random
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
A simple node to generate a random number when triggered.
|
||||
|
||||
If you return an integer it can include both the low and high values.
|
||||
If set to return an integer it can include both the low and high values.
|
||||
`min <= n <= max` - so selecting 1 to 6 will return values 1,2,3,4,5 or 6.
|
||||
|
||||
If you return a floating point value it will be from the low value, up to, but
|
||||
If set to return a floating point value it will be from the low value, up to, but
|
||||
not including the high value. `min <= n < max` - so selecting 1 to 6 will return values 1 <= n < 6 .
|
||||
|
||||
**Note:** This generates **numbers**.
|
||||
**Note:** This returns numbers - objects of type **number**.
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-random",
|
||||
"version" : "0.1.3",
|
||||
"version" : "0.1.4",
|
||||
"description" : "A Node-RED node that when triggered generates a random number between two values.",
|
||||
"dependencies" : {
|
||||
},
|
||||
|
@ -27,9 +27,9 @@
|
||||
</script>
|
||||
<script type="text/x-red" data-help-name="random">
|
||||
<p>Generates a random number between a low and high value.</p>
|
||||
<p>If you return an integer it can <i>include</i> both the low and high values.
|
||||
<p>If set to return an integer it can <i>include</i> both the low and high values.
|
||||
<code>min <= n <= max</code></p>
|
||||
<p>If you return a floating point value it will be from the low value, up to, but
|
||||
<p>If set to return a floating point value it will be from the low value, up to, but
|
||||
not including the high value. <code>min <= n < max</code></p>
|
||||
</script>
|
||||
|
||||
|
@ -7,9 +7,11 @@
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="smaz">
|
||||
<p>A function that converts the <code>msg.payload</code> to and from smaz format.</p>
|
||||
<p>A function that converts the <code>msg.payload</code> to and from the
|
||||
<a href="https://github.com/antirez/smaz/blob/master/README" target="_new">smaz</a>
|
||||
compression format.</p>
|
||||
<p>If the input is a string it tries to convert it to a smaz buffer.</p>
|
||||
<p>If the input is a smaz buffer it tries to decode it back to a string./</p>
|
||||
<p>If the input is a smaz buffer it tries to decode it back to a string.</p>
|
||||
<p>All other message types are dropped.</p>
|
||||
</script>
|
||||
|
||||
|
@ -6,7 +6,7 @@ A <a href="http://nodered.org" target="_new">Node-RED</a> node to pack and unpac
|
||||
Install
|
||||
-------
|
||||
|
||||
Run the following command in your Node-RED user directory - typically `~/.node-red`
|
||||
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 install node-red-node-smaz
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-smaz",
|
||||
"version" : "0.0.1",
|
||||
"version" : "0.0.2",
|
||||
"description" : "A Node-RED node to pack and unpack strings to smaz format",
|
||||
"dependencies" : {
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user