mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-01-13 15:52:55 +01:00
Initial commit
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com> Co-Authored-By: Johan <4934465+joolsus@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
46
packages/noodl-runtime/src/nodes/std-library/or.js
Normal file
46
packages/noodl-runtime/src/nodes/std-library/or.js
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
const OrNode = {
|
||||
name: 'Or',
|
||||
docs: 'https://docs.noodl.net/nodes/logic/or',
|
||||
category: 'Logic',
|
||||
initialize: function () {
|
||||
this._internal.inputs = [];
|
||||
},
|
||||
getInspectInfo() {
|
||||
return this._internal.inputs.some(isTrue);
|
||||
},
|
||||
numberedInputs: {
|
||||
input: {
|
||||
type: 'boolean',
|
||||
displayPrefix: 'Input',
|
||||
createSetter(index) {
|
||||
return function (value) {
|
||||
if (this._internal.inputs[index] === value) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._internal.inputs[index] = value;
|
||||
this.flagOutputDirty('result');
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
outputs: {
|
||||
result: {
|
||||
type: 'boolean',
|
||||
displayName: 'Result',
|
||||
getter: function () {
|
||||
return this._internal.inputs.some(isTrue);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
node: OrNode
|
||||
};
|
||||
|
||||
function isTrue(value) {
|
||||
return value ? true : false;
|
||||
}
|
||||
Reference in New Issue
Block a user