Based on underscore.js's flatten
330162
function flatten(a) {
  return a.reduce(function(flat, val) {
    if (val && typeof val.flatten === 'function') {
      flat = flat.concat(val.flatten());
    }
    else if (Array.isArray(val)) {
      flat = flat.concat(flatten(val));
    }
    else {
      flat.push(val);
    }
    return flat;
  });
}
787328
function underscoreToCamel (str) {
    str = str.charAt(0).toUpperCase() + str.slice(1);
    return str.replace(/\_(.)/g, function (x, chr) {
      return chr.toUpperCase();
    })
  }
147997
function(data, prefix) {
  prefix = prefix || '';
  var row = Object.keys(data).map(function(key) {
    if (typeof data[key] !== 'object') {
      return util.format('%s%s="%s"', prefix, key, data[key]);
    }
    // Flatten this nested object.
    return _reformat(data[key], key + '.');
  });
  return row.join(' ');
}
1279277
function flattenProperties (obj, prefix = null, globals = {}) {
    prefix = prefix ? (prefix + '.') : 'global.';

    for (const p in obj) {
        const key = prefix + p;
        const val = obj[p];
        globals[key] = val;

        if (typeof val === 'object' && !Array.isArray(val)) {
            flattenProperties(val, key, globals);
        }
    }
    return globals;
}
872843
def _process_underscores(self, tokens):
        ""
        groups = [[str(''.join(el))] if b else list(el)
                  for (b,el) in itertools.groupby(tokens, lambda k: k=='_')]
        flattened = [el for group in groups for el in group]
        processed = []
        for token in flattened:
            if token == '_':  continue
            if token.startswith('_'):
                token = str(token[1:])
            if token.endswith('_'):
                token = str(token[:-1])
            processed.append(token)
        return processed
707308
function flattenFields(fields) {
	const fieldsObj = {};
	fields.forEach(function(field) {
		if (!fields.hasOwnProperty(field.name)) {
			fieldsObj[field.name] = field.value;
		}
	});
	return fieldsObj;
}
897181
function flatten(object, options) {
  var i, j, value, result, flattened = {};
  options = options || {};
  var check = options.check || isNotObject;
  var separator = options.separator || '.';
  var affix = options.affix ? separator + options.affix + separator : separator;

  for (i in object) {
    value = object[i]
    if (check(value)) {
      flattened[i] = value;
      continue;
    }
    result = flatten(value, check);

    if (Array.isArray(value)) {
      for (j in result) {
        flattened[(i + '[' + j + ']').split(affix).join(separator)] = result[j];
      }
    } else {
      for (j in result) {
        flattened[(i + separator + j).split(affix).join(separator)] = result[j];
      }
    }
  }
  return flattened;
}
624916
function flattenDeep(array) {
      var length = array == null ? 0 : array.length;
      return length ? baseFlatten(array, INFINITY) : [];
    }
921872
function flatten(array, shallow) {

  shallow = shallow || false;

  if(!isArray(array)) {
    return array;
  }

  return (!shallow) ? depthFlatten(array, 0) :
    [].concat.apply([], array);
}
790395
function flatten(test) {
      return {
        title: test.title,
        duration: test.duration,
        err: test.err ? Object.assign({}, test.err) : null,
      };
    }
185730
def _re_flatten(p):
    '''  '''
    if '(' not in p: return p
    return re.sub(r'(\\*)(\(\?P<[^>]+>|\((?!\?))',
        lambda m: m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:', p)
659570
function flatten(obj,callback) {
    let arr = [];
    let iDepth, oDepth = 0;
    let state = {identityDetection:true};
    recurse(obj,state,function(obj,key,state){
        let entry = {};
        entry.name = key;
        entry.value = obj[key];
        entry.path = state.path;
        entry.parent = obj;
        entry.key = key;
        if (callback) entry = callback(entry);
        if (entry) {
            if (state.depth > iDepth) {
                oDepth++;
            }
            else if (state.depth < iDepth) {
                oDepth--;
            }
            entry.depth = oDepth;
            iDepth = state.depth;
            arr.push(entry);
        }
    });
    return arr;
}
604904
function flatten(array) {
        return array.reduce(function (a, b) {
            return isArray(b) ? a.concat(flatten(b)) : a.concat(b);
        }, []);
    }
1028604
def flatten(listish):
    
    for elem in listish:
        if (isinstance(elem, collections.Iterable)
                and not isinstance(elem, basestring)):
            for subelem in flatten(elem):
                yield subelem
        else:
            yield elem
407110
def flatatt(attrs):
    
    return _flatatt({k.replace('_', '-'): v for k, v in attrs.items()})
378191
function flatten (expression) {
  const expanded = Array.from(expandInner(expression))
  const flattened = expanded.reduce(function (result, clause) {
    return Object.assign(result, clause)
  }, {})
  return sort([flattened])[0]
}
389690
def flatten(l):
    '''  '''
    for el in l:
        if isinstance(el, collections.Iterable) and not isinstance(el, string_types):
            for sub in flatten(el):
                yield sub
        else:
            yield el