pax_global_header00006660000000000000000000000064126735555120014525gustar00rootroot0000000000000052 comment=f65cab875234f8a9ee9b28df5d4db5c4a92fd0d9 to-fast-properties-1.0.2/000077500000000000000000000000001267355551200152745ustar00rootroot00000000000000to-fast-properties-1.0.2/.editorconfig000066400000000000000000000002761267355551200177560ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [{package.json,*.yml}] indent_style = space indent_size = 2 to-fast-properties-1.0.2/.gitattributes000066400000000000000000000000141267355551200201620ustar00rootroot00000000000000* text=auto to-fast-properties-1.0.2/.gitignore000066400000000000000000000000151267355551200172600ustar00rootroot00000000000000node_modules to-fast-properties-1.0.2/.travis.yml000066400000000000000000000001151267355551200174020ustar00rootroot00000000000000sudo: false language: node_js node_js: - '5' - '4' - '0.12' - '0.10' to-fast-properties-1.0.2/index.js000066400000000000000000000002071267355551200167400ustar00rootroot00000000000000'use strict'; module.exports = function toFastProperties(obj) { function f() {} f.prototype = obj; new f(); return; eval(obj); }; to-fast-properties-1.0.2/license000066400000000000000000000021311267355551200166360ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2014 Petka Antonov 2015 Sindre Sorhus Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. to-fast-properties-1.0.2/package.json000066400000000000000000000012051267355551200175600ustar00rootroot00000000000000{ "name": "to-fast-properties", "version": "1.0.2", "description": "Force V8 to use fast properties for an object", "license": "MIT", "repository": "sindresorhus/to-fast-properties", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=0.10.0" }, "scripts": { "test": "node --allow-natives-syntax test.js" }, "files": [ "index.js" ], "keywords": [ "object", "obj", "properties", "props", "v8", "optimize", "fast", "convert", "mode" ], "devDependencies": { "ava": "0.0.4" } } to-fast-properties-1.0.2/readme.md000066400000000000000000000013351267355551200170550ustar00rootroot00000000000000# to-fast-properties [![Build Status](https://travis-ci.org/sindresorhus/to-fast-properties.svg?branch=master)](https://travis-ci.org/sindresorhus/to-fast-properties) > Force V8 to use fast properties for an object [Read more.](http://stackoverflow.com/questions/24987896/) Use `%HasFastProperties(object)` and `--allow-natives-syntax` to check whether an object already has fast properties. ## Install ``` $ npm install --save to-fast-properties ``` ## Usage ```js const toFastProperties = require('to-fast-properties'); const obj = { foo: true, bar: true }; delete obj.foo; // `obj` now has slow properties toFastProperties(obj); // `obj` now has fast properties ``` ## License MIT © Petka Antonov, Sindre Sorhus to-fast-properties-1.0.2/test.js000066400000000000000000000007551267355551200166200ustar00rootroot00000000000000'use strict'; var test = require('ava'); var toFastProperties = require('./'); var toSlowProperties = function (obj) { for (var i = 0; i < 1000; ++i) { obj['foo' + i] = 'foo'; } return obj; }; test(function (t) { var obj = toSlowProperties({}); obj.foo = 'foo'; t.assert(!%HasFastProperties(obj), 'obj has slow properties'); toFastProperties(obj); t.assert(%HasFastProperties(obj), 'obj has fast properties'); t.assert(obj.foo === 'foo', 'obj has the same keys'); t.end(); });