Node-Red configuration
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.js 1001B

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. let fastProto = null;
  3. // Creates an object with permanently fast properties in V8. See Toon Verwaest's
  4. // post https://medium.com/@tverwaes/setting-up-prototypes-in-v8-ec9c9491dfe2#5f62
  5. // for more details. Use %HasFastProperties(object) and the Node.js flag
  6. // --allow-natives-syntax to check whether an object has fast properties.
  7. function FastObject(o) {
  8. // A prototype object will have "fast properties" enabled once it is checked
  9. // against the inline property cache of a function, e.g. fastProto.property:
  10. // https://github.com/v8/v8/blob/6.0.122/test/mjsunit/fast-prototype.js#L48-L63
  11. if (fastProto !== null && typeof fastProto.property) {
  12. const result = fastProto;
  13. fastProto = FastObject.prototype = null;
  14. return result;
  15. }
  16. fastProto = FastObject.prototype = o == null ? Object.create(null) : o;
  17. return new FastObject;
  18. }
  19. // Initialize the inline property cache of FastObject
  20. FastObject();
  21. module.exports = function toFastproperties(o) {
  22. return FastObject(o);
  23. };