node-red-contrib-oussama 1.0.0
a personal node for testing
node-red-contrib-lowercase
A simple Node-RED node that converts incoming string payloads to lowercase.
🧩 Overview
This Node-RED node takes any input message (msg.payload
) and converts it to lowercase text.
It’s useful when you need to normalize text data before further processing, comparisons, or routing.
⚙️ Usage
- Drag the converterOussama node into your Node-RED workspace.
- Connect it to any node that outputs a string payload.
- Deploy your flow.
Example Flow:
[{"id":"input1","type":"inject","z":"flow1","name":"Hello World","props":[{"p":"payload"}],"payload":"Hello World","payloadType":"str"},{"id":"lower1","type":"lowercase","z":"flow1","name":"To Lowercase","wires":[["debug1"]]},{"id":"debug1","type":"debug","z":"flow1","name":"Result","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg"}]
When the flow runs, the Lowercase node will convert "Hello World"
into "hello world"
.
🧠 How It Works
- The node checks if
msg.payload
is a string. - If yes → it converts it to lowercase.
- If not → it passes the message through unchanged (optional behavior).
Example code inside the node:
if (typeof msg.payload === 'string') {
msg.payload = msg.payload.toLowerCase();
}
return msg;
🧪 Example
Input (msg.payload ) |
Output (msg.payload ) |
---|---|
"HELLO" |
"hello" |
"Node-RED Rocks!" |
"node-red rocks!" |
"123" |
"123" |
⚠️ Notes
- Non-string payloads are not modified.
- You can modify the node’s behavior to handle other properties if needed.
🛠️ Development
To test locally:
git clone https://github.com/<your-username>/node-red-contrib-lowercase.git
cd node-red-contrib-lowercase
npm install
npm link
cd ~/.node-red
npm link node-red-contrib-lowercase
Then restart Node-RED to load your development version.
📝 License
This project is licensed under the MIT License.
👤 Author
Your Name GitHub: @Oussama Ben Slama