Add Array.extend prototype

This commit is contained in:
pyoor 2017-06-13 13:19:09 -04:00
parent c0fbfcfd6e
commit c27266c234

View file

@ -53,6 +53,20 @@ Object.defineProperty(Array.prototype, 'map', function (fn, array) {
return result return result
}) })
Object.defineProperty(Array.prototype, 'extend', {
value: function (obj) {
if (Array.isArray(obj)) {
obj.forEach(function (v) {
if (typeof v !== 'undefined') {
this.push(v)
}
}, this)
} else {
this.push(obj)
}
}
})
Object.defineProperty(Object, 'isObject', { Object.defineProperty(Object, 'isObject', {
configurable: true, configurable: true,
enumerable: false, enumerable: false,