Add isConcatSpreadable to flatten methods.

This commit is contained in:
John-David Dalton
2016-07-21 08:41:06 -07:00
parent 3c4c06cb5e
commit 984a10c1b1
2 changed files with 31 additions and 6 deletions

View File

@@ -1336,10 +1336,11 @@
Symbol = context.Symbol,
Uint8Array = context.Uint8Array,
enumerate = Reflect ? Reflect.enumerate : undefined,
iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined,
iteratorSymbol = Symbol ? Symbol.iterator : undefined,
objectCreate = context.Object.create,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice;
splice = arrayProto.splice,
spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
/** Built-in method references that are mockable. */
var clearTimeout = function(id) { return context.clearTimeout.call(root, id); },
@@ -5869,7 +5870,8 @@
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
return isArray(value) || isArguments(value);
return isArray(value) || isArguments(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol])
}
/**