1.1.1 • Published 5 years ago

node-red-contrib-handlebars v1.1.1

Weekly downloads
120
License
MIT
Repository
github
Last release
5 years ago

Overview

Simple Node-Red module that allows you to apply handlebars to a given message (msg) property and place the results in a separate property.

FLOW JSON

[{"id":"128d44a7.7905cb","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"b055b07a.9c183","type":"handlebars","z":"128d44a7.7905cb","name":"","sourceProperty":"payload.person","targetProperty":"payload.response","query":"Hello {{name}}! Happy {{age}} birthday!","x":430,"y":180,"wires":[["96b8f886.005828"]]},{"id":"96b8f886.005828","type":"debug","z":"128d44a7.7905cb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":670,"y":180,"wires":[]},{"id":"2eb6a16e.fc7d7e","type":"inject","z":"128d44a7.7905cb","name":"Inject Payload","topic":"","payload":"{\"person\":{\"name\":\"John Doe\",\"age\":\"31\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":180,"wires":[["b055b07a.9c183"]]}]

For example, with the following configuration:

The following msg object:

{
	payload: {
		person: {
			"name": "John Doe",
			"age": "31"
		}
	}
}

Provides the following:

{
	payload: {
		response: "Hello John Doe! Happy 31 birthday!",
		person: {
			"name": "John Doe",
			"age": "31"
		}
	}
}

Running Tests

  • To test the project run npm run test or npm run test:watch to continuously test.

Running Linter

  • To run linters on the project, run npm run lint or npm run lint:watch to continously lint.