(type)
| 235 | * 6 -> findIndex |
| 236 | */ |
| 237 | function createArrayMethod(type){ |
| 238 | var isMap = type == 1 |
| 239 | , isFilter = type == 2 |
| 240 | , isSome = type == 3 |
| 241 | , isEvery = type == 4 |
| 242 | , isFindIndex = type == 6 |
| 243 | , noholes = type == 5 || isFindIndex; |
| 244 | return function(callbackfn/*, that = undefined */){ |
| 245 | var O = Object(assertDefined(this)) |
| 246 | , that = arguments[1] |
| 247 | , self = ES5Object(O) |
| 248 | , f = ctx(callbackfn, that, 3) |
| 249 | , length = toLength(self.length) |
| 250 | , index = 0 |
| 251 | , result = isMap ? Array(length) : isFilter ? [] : undefined |
| 252 | , val, res; |
| 253 | for(;length > index; index++)if(noholes || index in self){ |
| 254 | val = self[index]; |
| 255 | res = f(val, index, O); |
| 256 | if(type){ |
| 257 | if(isMap)result[index] = res; // map |
| 258 | else if(res)switch(type){ |
| 259 | case 3: return true; // some |
| 260 | case 5: return val; // find |
| 261 | case 6: return index; // findIndex |
| 262 | case 2: result.push(val); // filter |
| 263 | } else if(isEvery)return false; // every |
| 264 | } |
| 265 | } |
| 266 | return isFindIndex ? -1 : isSome || isEvery ? isEvery : result; |
| 267 | } |
| 268 | } |
| 269 | function createArrayContains(isContains){ |
| 270 | return function(el /*, fromIndex = 0 */){ |
| 271 | var O = toObject(this) |
no test coverage detected