var _GPF_COMPATIBILITY_ARRAY_THIS_ARG_INDEX = 1;
function _gpfArrayGetThisArg (args) {
return args[_GPF_COMPATIBILITY_ARRAY_THIS_ARG_INDEX];
function _gpfArrayBind (callback, args) {
var thisArg = _gpfArrayGetThisArg(args);
if (undefined !== thisArg) {
return callback.bind(thisArg);
function _gpfArrayForEachOwn (array, callback) {
if (Object.prototype.hasOwnProperty.call(array, idx)) {
callback(array[idx], idx, array);
function _gpfArrayEveryOwn (array, callback, startIdx) {
if (Object.prototype.hasOwnProperty.call(array, idx) && callback(array[idx], idx, array) !== true) {
function _gpfArrayEveryOwnFrom0 (array, callback) {
return _gpfArrayEveryOwn(array, callback, _GPF_START);
function _gpfArrayFromString (array, string) {
var length = string.length,
for (; index < length; ++index) {
array.push(string.charAt(index));
function _gpfArrayConvertFrom (arrayLike) {
if (typeof arrayLike === "string") {
_gpfArrayFromString(array, arrayLike);
_gpfArrayForEach(arrayLike, function (value) {
function _gpfArrayFrom (arrayLike, callback, thisArg) {
var array = _gpfArrayConvertFrom(arrayLike);
if (typeof callback === "function") {
array = array.map(callback, thisArg);
var _GPF_COMPATIBILITY_ARRAY_FROM_INDEX_INDEX = 1;
function _gpfArrayGetFromIndex (args) {
var fromIndex = args[_GPF_COMPATIBILITY_ARRAY_FROM_INDEX_INDEX];
if (undefined === fromIndex) {
_gpfCompatibilityInstallMethods("Array", {
every: function (callback) {
return _gpfArrayEveryOwnFrom0(this, _gpfArrayBind(callback, arguments));
filter: function (callback) {
boundCallback = _gpfArrayBind(callback, arguments);
_gpfArrayForEachOwn(this, function (item, idx, array) {
if (boundCallback(item, idx, array)) {
forEach: function (callback) {
_gpfArrayForEachOwn(this, _gpfArrayBind(callback, arguments));
includes: function (searchElement) {
return !_gpfArrayEveryOwn(this, function (value) {
return value !== searchElement;
}, _gpfArrayGetFromIndex(arguments));
indexOf: function (searchElement) {
_gpfArrayEveryOwn(this, function (value, index) {
if (value === searchElement) {
}, _gpfArrayGetFromIndex(arguments));
map: function (callback) {
var result = new Array(this.length),
boundCallback = _gpfArrayBind(callback, arguments);
_gpfArrayForEachOwn(this, function (item, index, array) {
result[index] = boundCallback(item, index, array);
some: function (callback) {
var boundCallback = _gpfArrayBind(callback, arguments);
return !_gpfArrayEveryOwnFrom0(this, function (item, index, array) {
return !boundCallback(item, index, array);
reduce: function (callback) {
var REDUCE_INITIAL_VALUE_INDEX = 1,
initialValue = arguments[REDUCE_INITIAL_VALUE_INDEX],
thisLength = this.length,
if (undefined === initialValue) {
for (; index < thisLength; ++index) {
value = callback(value, this[index], index, this);
from: function (arrayLike) {
return _gpfArrayFrom.apply(this, arguments);
isArray: function (arrayLike) {
return {}.toString.call(arrayLike) === "[object Array]";
_gpfIsArray = Array.isArray;