io-actions/app/blocks/logic/boolean.js
2025-08-01 16:24:55 -04:00

31 lines
540 B
JavaScript

/** @type {import('#types').BlockDefinitionRaw} */
export default {
type: 'io_logic_boolean',
name: "Boolean",
colour: 60,
description: "A true or false value.",
connections: {
mode: "value",
output: [ "expression", "boolean" ],
},
template: "%BOOL",
fields: {
BOOL: {
options: [
['true', 'TRUE'],
['false', 'FALSE'],
]
}
},
generators: {
json: block => {
const bool = block.getFieldValue('BOOL') === 'TRUE'
return [ JSON.stringify(bool), 0 ]
}
}
}