Sha256: b5366ea937d6371e6cff26b97c58a60bc6f49bb9d27c6f05dc4090d78526a82b

Contents?: true

Size: 1001 Bytes

Versions: 88

Compression:

Stored size: 1001 Bytes

Contents

'use strict';

let fastProto = null;

// Creates an object with permanently fast properties in V8. See Toon Verwaest's
// post https://medium.com/@tverwaes/setting-up-prototypes-in-v8-ec9c9491dfe2#5f62
// for more details. Use %HasFastProperties(object) and the Node.js flag
// --allow-natives-syntax to check whether an object has fast properties.
function FastObject(o) {
	// A prototype object will have "fast properties" enabled once it is checked
	// against the inline property cache of a function, e.g. fastProto.property:
	// https://github.com/v8/v8/blob/6.0.122/test/mjsunit/fast-prototype.js#L48-L63
	if (fastProto !== null && typeof fastProto.property) {
		const result = fastProto;
		fastProto = FastObject.prototype = null;
		return result;
	}
	fastProto = FastObject.prototype = o == null ? Object.create(null) : o;
	return new FastObject;
}

// Initialize the inline property cache of FastObject
FastObject();

module.exports = function toFastproperties(o) {
	return FastObject(o);
};

Version data entries

88 entries across 87 versions & 14 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.59 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.58 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.57 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.56 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.55 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.54 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.53 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.52 node_modules/to-fast-properties/index.js
trusty-cms-6.3.1 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.51 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.50 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.49 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.48 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.47 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.46 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.45 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.44 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.43 node_modules/to-fast-properties/index.js
immosquare-cleaner-0.1.42 node_modules/to-fast-properties/index.js