replace jest with ava
This commit is contained in:
parent
27cc8b23fe
commit
0347b72305
11775 changed files with 84546 additions and 1440575 deletions
36
node_modules/concordance/lib/getObjectKeys.js
generated
vendored
Normal file
36
node_modules/concordance/lib/getObjectKeys.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
'use strict'
|
||||
|
||||
function getObjectKeys (obj, excludeListItemAccessorsBelowLength) {
|
||||
const keys = []
|
||||
let size = 0
|
||||
|
||||
// Sort property names, they should never be order-sensitive
|
||||
const nameCandidates = Object.getOwnPropertyNames(obj).sort()
|
||||
// Comparators should verify symbols in an order-insensitive manner if
|
||||
// possible.
|
||||
const symbolCandidates = Object.getOwnPropertySymbols(obj)
|
||||
|
||||
for (let i = 0; i < nameCandidates.length; i++) {
|
||||
const name = nameCandidates[i]
|
||||
|
||||
let accept = true
|
||||
if (excludeListItemAccessorsBelowLength > 0) {
|
||||
const index = Number(name)
|
||||
accept = (index % 1 !== 0) || index >= excludeListItemAccessorsBelowLength
|
||||
}
|
||||
|
||||
if (accept && Object.getOwnPropertyDescriptor(obj, name).enumerable) {
|
||||
keys[size++] = name
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < symbolCandidates.length; i++) {
|
||||
const symbol = symbolCandidates[i]
|
||||
if (Object.getOwnPropertyDescriptor(obj, symbol).enumerable) {
|
||||
keys[size++] = symbol
|
||||
}
|
||||
}
|
||||
|
||||
return { keys, size }
|
||||
}
|
||||
module.exports = getObjectKeys
|
||||
Loading…
Add table
Add a link
Reference in a new issue