1 |
3a515b92
|
cagy
|
# to-fast-properties [![Build Status](https://travis-ci.org/sindresorhus/to-fast-properties.svg?branch=master)](https://travis-ci.org/sindresorhus/to-fast-properties)
|
2 |
|
|
|
3 |
|
|
> Force V8 to use fast properties for an object
|
4 |
|
|
|
5 |
|
|
[Read more.](http://stackoverflow.com/questions/24987896/)
|
6 |
|
|
|
7 |
|
|
Use `%HasFastProperties(object)` and `--allow-natives-syntax` to check whether an object already has fast properties.
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
## Install
|
11 |
|
|
|
12 |
|
|
```
|
13 |
|
|
$ npm install --save to-fast-properties
|
14 |
|
|
```
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
## Usage
|
18 |
|
|
|
19 |
|
|
```js
|
20 |
|
|
const toFastProperties = require('to-fast-properties');
|
21 |
|
|
|
22 |
|
|
const obj = {
|
23 |
|
|
foo: true,
|
24 |
|
|
bar: true
|
25 |
|
|
};
|
26 |
|
|
|
27 |
|
|
delete obj.foo;
|
28 |
|
|
// `obj` now has slow properties
|
29 |
|
|
|
30 |
|
|
toFastProperties(obj);
|
31 |
|
|
// `obj` now has fast properties
|
32 |
|
|
```
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
## License
|
36 |
|
|
|
37 |
|
|
MIT © Petka Antonov, Sindre Sorhus
|