frontend/.pnpm-store/v3/files/ab/62ef63c32f4627f72bd67c7452963086af8d0f18b9fb77def2bb12621ffc08fd25920e9d36b2bb463c844a2ea015be4352192dc99753bb22fdabbf42868ba5

28 lines
792 B
Plaintext

"use strict";
var isPrototype = require("../prototype/is");
var isArray;
if (typeof Array.isArray === "function") {
isArray = Array.isArray;
} else {
var objectToString = Object.prototype.toString, objectTaggedString = objectToString.call([]);
isArray = function (value) { return objectToString.call(value) === objectTaggedString; };
}
module.exports = function (value) {
if (!isArray(value)) return false;
// Sanity check (reject objects which do not expose common Array interface)
if (!hasOwnProperty.call(value, "length")) return false;
try {
if (typeof value.length !== "number") return false;
if (typeof value.push !== "function") return false;
if (typeof value.splice !== "function") return false;
} catch (error) {
return false;
}
return !isPrototype(value);
};