WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 7fa5323

Browse files
committed
Fixup Syntax vs API and markdown rendering
1 parent ada148e commit 7fa5323

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ This creates intermediate arrays, causing unnecessary memory usage and garbage c
145145

146146
On top of that, it is also not possible to identify an array that is sparse without calling `Object.keys()` (or similar). This API would allow that by explicitly checking for own index properties.
147147

148-
## Proposed Syntax
148+
## Proposed API
149149

150150
```javascript
151151
Object.propertyCount(target[, options])
@@ -250,22 +250,22 @@ When the `propertyCount` method is called, the following steps are taken:
250250
3. Let _keyTypes_ be ? Get(_options_, "keyTypes").
251251
4. If _keyTypes_ is undefined, set _keyTypes_ to the array `['index', 'nonIndexString']`.
252252
5. Else, perform the following:
253-
a. If Type(_keyTypes_) is not Object, throw a TypeError exception.
254-
b. Set _keyTypes_ to an internal List whose elements are the String values of the elements of _keyTypes_.
255-
c. If _keyTypes_ contains any value other than "index", "nonIndexString", or "symbol", throw a TypeError exception.
256-
6. Let _enumerable_ be ? Get(_options_, "enumerable").
257-
7. If _enumerable_ is undefined, set _enumerable_ to true.
258-
8. Else if _enumerable_ is not one of true, false, or "all", throw a TypeError exception.
259-
9. Let _count_ be 0.
260-
10. Let _ownKeys_ be the List of own property keys of _target_, in the order returned by OrdinaryOwnPropertyKeys(_target_). (Note: No intermediate array should be allocated.)
261-
11. For each element _key_ of _ownKeys_, perform the following steps:
262-
a. Let _desc_ be ? OrdinaryGetOwnProperty(_target_, _key_).
263-
b. If _enumerable_ is not 'all'
253+
1. If Type(_keyTypes_) is not Object, throw a TypeError exception.
254+
2. Set _keyTypes_ to an internal List whose elements are the String values of the elements of _keyTypes_.
255+
3. If _keyTypes_ contains any value other than "index", "nonIndexString", or "symbol", throw a TypeError exception.
256+
1. Let _enumerable_ be ? Get(_options_, "enumerable").
257+
2. If _enumerable_ is undefined, set _enumerable_ to true.
258+
3. Else if _enumerable_ is not one of true, false, or "all", throw a TypeError exception.
259+
4. Let _count_ be 0.
260+
5. Let _ownKeys_ be the List of own property keys of _target_, in the order returned by OrdinaryOwnPropertyKeys(_target_). (Note: No intermediate array should be allocated.)
261+
6. For each element _key_ of _ownKeys_, perform the following steps:
262+
1. Let _desc_ be ? OrdinaryGetOwnProperty(_target_, _key_).
263+
2. If _enumerable_ is not 'all'
264264
i. If _enumerable_ is unequal to _desc_.[[Enumerable]], continue to the next _key_.
265-
c. If Type(_key_) is Symbol and "symbol" is present in _keyTypes_, increment _count_ by 1.
266-
d. Else if Type(_key_) is array index and "index" is present in _keyTypes_, increment _count_ by 1.
267-
e. Else if "nonIndexString" is present in _keyTypes_, increment _count_ by 1
268-
12. Return _count_.
265+
3. If Type(_key_) is Symbol and "symbol" is present in _keyTypes_, increment _count_ by 1.
266+
4. Else if Type(_key_) is array index and "index" is present in _keyTypes_, increment _count_ by 1.
267+
5. Else if "nonIndexString" is present in _keyTypes_, increment _count_ by 1
268+
7. Return _count_.
269269

270270
## Alternatives Considered
271271

0 commit comments

Comments
 (0)