Add non enumable property to push* function of the Array prototype

This commit is contained in:
Romain 2014-07-22 11:58:30 +02:00
parent 9b731d3a58
commit 3a9e652175
1 changed files with 4 additions and 0 deletions

View File

@ -21,17 +21,21 @@ var Util = {};
Array.prototype.push8 = function (num) {
this.push(num & 0xFF);
};
Object.defineProperty(Array.prototype, 'push8', {enumerable: false});
Array.prototype.push16 = function (num) {
this.push((num >> 8) & 0xFF,
(num ) & 0xFF );
};
Object.defineProperty(Array.prototype, 'push16', {enumerable: false});
Array.prototype.push32 = function (num) {
this.push((num >> 24) & 0xFF,
(num >> 16) & 0xFF,
(num >> 8) & 0xFF,
(num ) & 0xFF );
};
Object.defineProperty(Array.prototype, 'push32', {enumerable: false});
// IE does not support map (even in IE9)
//This prototype is provided by the Mozilla foundation and