Frontend/25_01_07/mai/node_modules/es-abstract/2015/IsConcatSpreadable.js

27 lines
631 B
JavaScript
Raw Normal View History

2025-01-28 10:38:27 +00:00
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true);
var Get = require('./Get');
var IsArray = require('./IsArray');
var ToBoolean = require('./ToBoolean');
var isObject = require('../helpers/isObject');
// https://262.ecma-international.org/6.0/#sec-isconcatspreadable
module.exports = function IsConcatSpreadable(O) {
if (!isObject(O)) {
return false;
}
if ($isConcatSpreadable) {
var spreadable = Get(O, $isConcatSpreadable);
if (typeof spreadable !== 'undefined') {
return ToBoolean(spreadable);
}
}
return IsArray(O);
};