Sha256: 37d206a16461600acfb3c260ef4179e25ba5bb92cb13d50f539eafbffd0e4531
Contents?: true
Size: 668 Bytes
Versions: 29
Compression:
Stored size: 668 Bytes
Contents
'use strict'; var isPlainArray = require('../../is-plain-array') , callable = require('../../../object/valid-callable') , isArray = Array.isArray, filter = Array.prototype.filter , forEach = Array.prototype.forEach, call = Function.prototype.call; module.exports = function (callbackFn/*, thisArg*/) { var result, thisArg, i; if (!this || !isArray(this) || isPlainArray(this)) { return filter.apply(this, arguments); } callable(callbackFn); thisArg = arguments[1]; result = new this.constructor(); i = 0; forEach.call(this, function (val, j, self) { if (call.call(callbackFn, thisArg, val, j, self)) result[i++] = val; }); return result; };
Version data entries
29 entries across 19 versions & 7 rubygems