index.js
function flatten(data, pre) {
  const prefix = pre || '';
  const keys = Object.keys(data);
  const result = {};
  keys.forEach((k) => {
    const value = data[k];
    const key = [prefix, k].join('-');
    if (isObject(value)) {
      Object.assign(result, flatten(value, key));
    } else {
      result[key] = value;
    }
  });
  return result;
}
function flatten(data, pre) {
  const prefix = pre || '';
  const keys = Object.keys(data);
  const result = {};
  keys.forEach((k) => {
    const value = data[k];
    const key = [prefix, k].join('-');
    if (isObject(value)) {
      Object.assign(result, flatten(value, key));
    } else {
      result[key] = value;
    }
  });
  return result;
}
function flatten ( data , pre ) { const prefix = pre || '' ; const keys = Object . keys ( data ) ; const result = { } ; keys . forEach ( ( k ) => { const value = data [ k ] ; const key = [ prefix , k ] . join ( '-' ) ; if ( isObject ( value ) ) { Object . assign ( result , flatten ( value , key ) ) ; } else { result [ key ] = value ; } } ) ; return result ; }
Flatten the data

@param {Object} data
@returns
Flatten the data