lib/jsx.js
function flatten(...args) {
  return (0, _transform2.default)((0, _flattenDeep2.default)(args), (accumulator, value) => {
    if (!value) {
      return;
    }
    const lastIndex = accumulator.length - 1;

    if ((0, _isString2.default)(value) && (0, _isString2.default)(accumulator[lastIndex])) {
      accumulator[lastIndex] += value;
    } else {
      accumulator.push(value);
    }
  }, []);
}
function flatten(...args) {
  return (0, _transform2.default)((0, _flattenDeep2.default)(args), (accumulator, value) => {
    if (!value) {
      return;
    }
    const lastIndex = accumulator.length - 1;

    if ((0, _isString2.default)(value) && (0, _isString2.default)(accumulator[lastIndex])) {
      accumulator[lastIndex] += value;
    } else {
      accumulator.push(value);
    }
  }, []);
}
function flatten ( ... args ) { return ( 0 , _transform2 . default ) ( ( 0 , _flattenDeep2 . default ) ( args ) , ( accumulator , value ) => { if ( ! value ) { return ; } const lastIndex = accumulator . length - 1 ; if ( ( 0 , _isString2 . default ) ( value ) && ( 0 , _isString2 . default ) ( accumulator [ lastIndex ] ) ) { accumulator [ lastIndex ] += value ; } else { accumulator . push ( value ) ; } } , [ ] ) ; }
Recursively flattens `args`, removes falsy values and combines string values.

Can be used as a simple optimization step on the JSX children-to-be to simplify the resulting DOM structure by
joining adjacent text nodes together.

@memberof module:jsx
@method flatten
@param {...*} args - the input values
@return {Array<*>} the flattened result
@example
import {flatten} from 'webcompiler';
// or - import {flatten} from 'webcompiler/lib/jsx';
// or - var flatten = require('webcompiler').flatten;
// or - var flatten = require('webcompiler/lib/jsx').flatten;

flatten('lorem ', ['ipsum ', null, ['dolor ', ['sit ', ['amet']]]]); // ["lorem ipsum dolor sit amet"]
Recursively flattens args removes falsy values and combines string values .