Update negate.js

This commit is contained in:
Tyler Cooper 2025-08-14 14:48:08 -05:00 committed by GitHub
parent 25fc9cfda5
commit 53545ba248
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,23 +4,19 @@ export default {
bytecodeKey: "negate", bytecodeKey: "negate",
name: "Negate", name: "Negate",
colour: 60, colour: 60,
description: "Swaps a truthy value to `false`, or a falsy value to `true`.", description: "Flip any condition to its opposite - turns true into false and false into true. Essential for creating inverse logic like 'if NOT raining', 'if door is NOT open', or 'if temperature is NOT above 75°F'. Perfect for building exception handling, safety conditions, and reverse automation logic in your IoT Actions.",
connections: { connections: {
mode: "value", mode: "value",
output: "expression", output: "expression",
}, },
template: "not %EXPRESSION", template: "not %EXPRESSION",
inputs: { inputs: {
EXPRESSION: { EXPRESSION: {
description: "Block diagram that will be resolved, then have its truthiness flipped.", description: "Connect any condition or comparison that you want to reverse. Examples: attach 'temperature > 80' to create 'NOT temperature > 80' (meaning temperature ≤ 80), or 'motion detected' to create 'NOT motion detected' (meaning no motion).",
check: "expression", check: "expression",
shadow: 'io_logic_boolean' shadow: 'io_logic_boolean'
} }
}, },
generators: { generators: {
json: (block, generator) => { json: (block, generator) => {
const const
@ -30,15 +26,12 @@ export default {
target: JSON.parse(operand) target: JSON.parse(operand)
} }
} }
return [ JSON.stringify(payload), 0 ] return [ JSON.stringify(payload), 0 ]
} }
}, },
regenerators: { regenerators: {
json: (blockObject, helpers) => { json: (blockObject, helpers) => {
const payload = blockObject.negate const payload = blockObject.negate
return { return {
type: 'io_logic_negate', type: 'io_logic_negate',
inputs: { inputs: {