blockly-fluid 1.4.29 → 1.4.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +8 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -200,14 +200,17 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
200
200
  if ((typeof next === "function") ? next() : next) this.setNextStatement(true, null);
201
201
  } else {
202
202
  if (output === "Color") (output = "Colour");
203
- if ((typeof output === "function") && ![String, Number, Boolean, Array, Object].includes(output)) {
204
- console.log(output, [String, Number, Boolean, Array, Object].includes(output));
205
- output = output();
206
- };
203
+ if ((typeof output === "function") && !["String", "Number", "Boolean", "Array", "Object"].includes(output.name)) (output = output());
207
204
 
208
205
  this.setPreviousStatement(false);
209
206
  this.setNextStatement(false);
210
- this.setOutput(true, (output === true) ? null : (([String, Number, Boolean, Array, Object].includes(output)) ? output.name : ((Array.isArray(output)) ? output.map((type) => ([String, Number, Boolean, Array, Object].includes(type)) ? type.name : type) : output)));
207
+
208
+ this.setOutput(true, (output === true) ? null : ((["String", "Number", "Boolean", "Array", "Object"].includes(output?.name)) ? output.name : ((Array.isArray(output)) ? output.map((type) => {
209
+ if (type === "Color") (type = "Colour");
210
+ if ((typeof type === "function") && !["String", "Number", "Boolean", "Array", "Object"].includes(type.name)) (type = type());
211
+
212
+ return (["String", "Number", "Boolean", "Array", "Object"].includes(type?.name)) ? type.name : type;
213
+ }) : output)));
211
214
  };
212
215
 
213
216
  this.setColour(color);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockly-fluid",
3
- "version": "1.4.29",
3
+ "version": "1.4.30",
4
4
  "description": "A flexible proxy wrapper for Blockly blocks.",
5
5
  "main": "index.js",
6
6
  "scripts": {