assets/js/twilio.js
/**
 * Map a list to an array of arrays, and return the flattened result.
 * @param {Array<*>|Set<*>|Map<*>} list
 * @param {function(*): Array<*>} [mapFn]
 * @returns Array<*>
 */
Map a list to an array of arrays, and return the flattened result.
Map a list to an array of arrays and return the flattened result .
function flatMap(list, mapFn) {
    var listArray = list instanceof Map || list instanceof Set
        ? Array.from(list.values())
        : list;
    mapFn = mapFn || (function (item) { return item; });
    return listArray.reduce(function (flattened, item) {
        var mapped = mapFn(item);
        return flattened.concat(mapped);
    }, []);
}
function flatMap ( list , mapFn ) { var listArray = list instanceof Map || list instanceof Set ? Array . from ( list . values ( ) ) : list ; mapFn = mapFn || ( function ( item ) { return item ; } ) ; return listArray . reduce ( function ( flattened , item ) { var mapped = mapFn ( item ) ; return flattened . concat ( mapped ) ; } , [ ] ) ; }
Map a list to an array of arrays, and return the flattened result.
Map a list to an array of arrays and return the flattened result .