Created
April 22, 2015 23:44
-
-
Save cfv1984/2e3fb261f5df6d757eb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cfv = {}; | |
// Original is (C) Andrea Giammarchi - Mit Style License | |
cfv.Array = (function(){ | |
function extendedArray(length){ | |
if(arguments.length === 1 && typeof length === "number") this.length = -1 < length && length === length << 1 >> 1 ? length : this.push(length); | |
else if(arguments.length) this.push.apply(this, arguments); | |
}; | |
function Array(){}; | |
Array.prototype = []; | |
extendedArray.prototype = new Array; | |
extendedArray.prototype.length = 0; | |
extendedArray.prototype.toString = function(){ | |
return this.slice(0).toString(); | |
}; | |
extendedArray.prototype.constructor = extendedArray; | |
return extendedArray; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment