How to use the node-red/red/red.js.hasOwnProperty function in node-red

To help you get started, we’ve selected a few node-red examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BiancoRoyal / node-red-contrib-modbus / src / testing / nodered-helper.js View on Github external
defer.resolve(testCredentials)
        return defer.promise
      },
      saveCredentials: function () {
                // do nothing
      }
    }
    var settings = {
      available: function () {
        return false
      }
    }

    var red = {}
    for (var i in RED) {
      if (RED.hasOwnProperty(i) && !/^(init|start|stop)$/.test(i)) {
        var propDescriptor = Object.getOwnPropertyDescriptor(RED, i)
        Object.defineProperty(red, i, propDescriptor)
      }
    }

    red['_'] = function (messageId) {
      return messageId
    }

    redNodes.init({settings: settings, storage: storage, log: log})
    credentials.init(storage, express())
    RED.nodes.registerType('helper', helperNode)

    if (Array.isArray(testNode)) {
      for (var n = 0; n < testNode.length; n++) {
        testNode[n](red)