_isFlattenable.js 608 B

1234567891011121314151617181920
  1. var Symbol = require('./_Symbol'),
  2. isArguments = require('./isArguments'),
  3. isArray = require('./isArray');
  4. /** Built-in value references. */
  5. var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
  6. /**
  7. * Checks if `value` is a flattenable `arguments` object or array.
  8. *
  9. * @private
  10. * @param {*} value The value to check.
  11. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  12. */
  13. function isFlattenable(value) {
  14. return isArray(value) || isArguments(value) ||
  15. !!(spreadableSymbol && value && value[spreadableSymbol]);
  16. }
  17. module.exports = isFlattenable;