2020-08-26 01:57:08 +02:00
|
|
|
'use strict';
|
|
|
|
|
2021-02-26 04:58:33 +01:00
|
|
|
var GetIntrinsic = require('get-intrinsic');
|
2020-08-26 01:57:08 +02:00
|
|
|
|
|
|
|
var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true);
|
|
|
|
|
|
|
|
var Get = require('./Get');
|
|
|
|
var IsArray = require('./IsArray');
|
|
|
|
var ToBoolean = require('./ToBoolean');
|
|
|
|
var Type = require('./Type');
|
|
|
|
|
|
|
|
// https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable
|
|
|
|
|
|
|
|
module.exports = function IsConcatSpreadable(O) {
|
|
|
|
if (Type(O) !== 'Object') {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ($isConcatSpreadable) {
|
|
|
|
var spreadable = Get(O, $isConcatSpreadable);
|
|
|
|
if (typeof spreadable !== 'undefined') {
|
|
|
|
return ToBoolean(spreadable);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return IsArray(O);
|
|
|
|
};
|