Node-Red configuration
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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. };