Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 6x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x | const isType = type => obj =>
obj != null && Object.prototype.toString.call(obj) === `[object ${type}]`
// FIXME: isFn, isArr is incorrect
export const isFn = isType('Function')
export const isArr = Array.isArray || isType('Array')
export const isPlainObj = isType('Object')
export const isStr = isType('String')
export const isBool = isType('Boolean')
export const isNum = isType('Number')
export const isObj = val => typeof val === 'object'
export const isRegExp = isType('RegExp')
const isArray = isArr
const keyList = Object.keys
const hasProp = Object.prototype.hasOwnProperty
export const isEqual = (a, b) => {
Eif (a === b) {
return true
}
if (a && b && typeof a === 'object' && typeof b === 'object') {
const arrA = isArray(a)
const arrB = isArray(b)
let i
let length
let key
if (arrA && arrB) {
length = a.length
if (length !== b.length) {
return false
}
for (i = length; i-- !== 0; ) {
if (!isEqual(a[i], b[i])) {
return false
}
}
return true
}
if (arrA !== arrB) {
return false
}
const keys = keyList(a)
length = keys.length
if (length !== keyList(b).length) {
return false
}
for (i = length; i-- !== 0; ) {
if (!hasProp.call(b, keys[i])) {
return false
}
}
for (i = length; i-- !== 0; ) {
key = keys[i]
if (!isEqual(a[key], b[key])) {
return false
}
}
return true
}
return a !== a && b !== b
}
|