frontend/.pnpm-store/v3/files/19/34db5c9b2858c59840bb835c65857422a6ed8ae6b219e11826af950715ae1b6e887555acaed045e0f8fc61e0f0ede709d4abedff779ccf4bc25c14b5fc4342

23 lines
681 B
Plaintext

"use strict";
var isPlainArray = require("../../is-plain-array")
, callable = require("../../../object/valid-callable")
, isArray = Array.isArray
, map = Array.prototype.map
, forEach = Array.prototype.forEach
, call = Function.prototype.call;
module.exports = function (callbackFn /*, thisArg*/) {
var result, thisArg;
if (!this || !isArray(this) || isPlainArray(this)) {
return map.apply(this, arguments);
}
callable(callbackFn);
thisArg = arguments[1];
result = new this.constructor(this.length);
forEach.call(this, function (val, i, self) {
result[i] = call.call(callbackFn, thisArg, val, i, self);
});
return result;
};