toFunctionName,
} from "./function.js";
import {
+ IS_CONCAT_SPREADABLE,
ITERATOR,
SPECIES,
toLength,
}
};
+export const {
+ /**
+ * Returns whether the provided value is spreadable during array
+ * concatenation.
+ *
+ * This is also used to determine which things should be treated as
+ * collections.
+ */
+ isConcatSpreadableObject,
+} = (() => {
+ const { isArray } = Array;
+
+ return {
+ isConcatSpreadableObject: ($) => {
+ if (type($) !== "object") {
+ // The provided value is not an object.
+ return false;
+ } else {
+ // The provided value is an object.
+ const spreadable = $[IS_CONCAT_SPREADABLE];
+ return spreadable !== undefined ? !!spreadable : isArray($);
+ }
+ },
+ };
+})();
+
/**
* Returns whether the provided object is extensible.
*