fixed define
parent
4e459de01c
commit
e91ce6387a
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "es.shim",
|
||||
"version": "2.4.2",
|
||||
"version": "2.4.3",
|
||||
"description": "实现部分新API, 以及一些常用的扩展方法",
|
||||
"keyworks": [
|
||||
"es5",
|
||||
|
|
|
@ -17,13 +17,15 @@ Object.defineProperty(Array.prototype, 'flat', {
|
|||
}
|
||||
|
||||
return arr
|
||||
}
|
||||
},
|
||||
writable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(Array.prototype, 'flatMap', {
|
||||
value(fn) {
|
||||
return this.map(fn).flat()
|
||||
}
|
||||
},
|
||||
writable: true
|
||||
})
|
||||
|
||||
if (!Array.prototype.at) {
|
||||
|
|
|
@ -10,7 +10,8 @@ const NATIVE_TO_FIXED = Number.prototype.toFixed
|
|||
Object.defineProperty(Number.prototype, 'toFixed', {
|
||||
value(n) {
|
||||
return NATIVE_TO_FIXED.call(this + Number.EPSILON, n)
|
||||
}
|
||||
},
|
||||
writable: true
|
||||
})
|
||||
|
||||
// 简单的数字处理
|
||||
|
|
|
@ -13,3 +13,7 @@ if (!Promise.defer) {
|
|||
return obj
|
||||
}
|
||||
}
|
||||
|
||||
if (!Promise.withResolvers) {
|
||||
Promise.withResolvers = Promise.defer
|
||||
}
|
||||
|
|
|
@ -104,5 +104,6 @@ if (!Set.prototype.union) {
|
|||
Object.defineProperty(Set.prototype, 'equals', {
|
||||
value(other) {
|
||||
return this.size === other.size && this.isSubsetOf(other)
|
||||
}
|
||||
},
|
||||
writable: true
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue