1
|
'use strict';
|
2
|
|
3
|
var GetIntrinsic = require('../GetIntrinsic');
|
4
|
|
5
|
var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true);
|
6
|
|
7
|
var Get = require('./Get');
|
8
|
var IsArray = require('./IsArray');
|
9
|
var ToBoolean = require('./ToBoolean');
|
10
|
var Type = require('./Type');
|
11
|
|
12
|
// https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable
|
13
|
|
14
|
module.exports = function IsConcatSpreadable(O) {
|
15
|
if (Type(O) !== 'Object') {
|
16
|
return false;
|
17
|
}
|
18
|
if ($isConcatSpreadable) {
|
19
|
var spreadable = Get(O, $isConcatSpreadable);
|
20
|
if (typeof spreadable !== 'undefined') {
|
21
|
return ToBoolean(spreadable);
|
22
|
}
|
23
|
}
|
24
|
return IsArray(O);
|
25
|
};
|