Created
July 30, 2018 16:53
-
-
Save luislobo14rap/db7e9fe8e476962a7bbebe15bac3ac41 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//array-prototypes.js v1 | |
// isArray v1 | |
function isArray(array) { | |
return Object.prototype.toString.call(array) == '[object Array]'; | |
}; | |
if (!Array.isArray) { | |
Array.isArray = function(array) { | |
return isArray(array); | |
}; | |
}; | |
Object.prototype.isArray = function() { | |
return isArray(this); | |
}; | |
Object.prototype.isArray = function() { | |
return isArray(this); | |
}; | |
String.prototype.isArray = function() { | |
return false; | |
}; | |
// isEmptyArray v1 | |
function isEmptyArray(array) { | |
if (Object.prototype.toString.call(array) == '[object Array]') { | |
if (array.length == 0) { | |
return true; | |
}; | |
}; | |
return false; | |
}; | |
Array.isEmptyArray = function(array) { | |
return isEmptyArray(array); | |
}; | |
Object.prototype.isEmptyArray = function() { | |
return isEmptyArray(this); | |
}; | |
String.prototype.isEmptyArray = function() { | |
return false; | |
}; |
This file contains hidden or 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
//array-prototypes.min.js v1 | |
function isArray(a){return'[object Array]'==Object.prototype.toString.call(a)}Array.isArray||(Array.isArray=function(a){return isArray(a)});Object.prototype.isArray=function(){return isArray(this)},Object.prototype.isArray=function(){return isArray(this)},String.prototype.isArray=function(){return!1};function isEmptyArray(a){if('[object Array]'==Object.prototype.toString.call(a)&&0==a.length)return!0;return!1}Array.isEmptyArray=function(a){return isEmptyArray(a)},Object.prototype.isEmptyArray=function(){return isEmptyArray(this)},String.prototype.isEmptyArray=function(){return!1}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment