Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
752 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | # 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, John-David Dalton, Sindre Sorhus
|
---|
Note:
See
TracBrowser
for help on using the repository browser.