Fix isFlattenable.

This commit is contained in:
John-David Dalton
2017-01-10 19:26:26 -08:00
parent e45db2e507
commit b2504adb30

View File

@@ -1,5 +1,8 @@
import isArguments from './isArguments.js'; import isArguments from './isArguments.js';
/** Built-in value reference. */
const spreadableSymbol = Symbol.isConcatSpreadable;
/** /**
* Checks if `value` is a flattenable `arguments` object or array. * Checks if `value` is a flattenable `arguments` object or array.
* *
@@ -9,7 +12,7 @@ import isArguments from './isArguments.js';
*/ */
function isFlattenable(value) { function isFlattenable(value) {
return Array.isArray(value) || isArguments(value) || return Array.isArray(value) || isArguments(value) ||
!!(Symbol.isConcatSpreadable && value && value[spreadableSymbol]); !!(spreadableSymbol && value && value[spreadableSymbol]);
} }
export default isFlattenable; export default isFlattenable;