Skip to content

Commit

Permalink
Fixed hasAttribute blockly block
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Mar 30, 2024
1 parent e037a79 commit f6d7802
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ NodeJS >= 18.x and js-controller >= 5 is required

* (klein0r) Added missing functions to protectFS
* (klein0r) Fixed httpPost (missing data)
* (klein0r) Fixed hasAttribute blockly block

### 7.11.1 (2024-03-28)

Expand Down
4 changes: 2 additions & 2 deletions src/public/google-blockly/own/blocks_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@ Blockly.Blocks['object_has_attr'] = {

Blockly.JavaScript['object_has_attr'] = function(block) {
const obj = Blockly.JavaScript.valueToCode(block, 'OBJECT', Blockly.JavaScript.ORDER_ATOMIC);
const attr = Blockly.JavaScript.valueToCode(block, 'ATTR', Blockly.JavaScript.ORDER_ATOMIC);
const attr = block.getFieldValue('ATTR');

return [`Object.prototype.hasOwnProperty.call(${obj}, ${attr})`, Blockly.JavaScript.ORDER_ATOMIC];
return [`Object.prototype.hasOwnProperty.call(${obj}, '${attr}')`, Blockly.JavaScript.ORDER_ATOMIC];
};

// --- object keys --------------------------------------------------
Expand Down

0 comments on commit f6d7802

Please sign in to comment.