function iterator(traverse, obj, options) {
  return function reduce(stack, entity) {
    var base = obj ? obj[entity] : entity
      , name = options.name || entity;

    //
    // Fabricated objects should provide each constructor with the name
    // of its property on the original object.
    //
    if (obj) options.name = entity;

    //
    // Run the functions, traverse will handle init.
    //
    if (js(base)) {
      return stack.concat(init(
        base,
        'string' === is(name) ? name : '',
        options
      ));
    }

    //
    // When we've been supplied with an array as base assume we want to keep it
    // as array and do not want it to be merged.
    //
    if (Array.isArray(base)) {
      options.name = name; // Force the name of the entry for all items in array.
      stack.push(traverse(base, options));

      return stack;
    }

    return stack.concat(traverse(base, options));
  };
}
function iterator(traverse, obj, options) {
  return function reduce(stack, entity) {
    var base = obj ? obj[entity] : entity
      , name = options.name || entity;

    //
    // Fabricated objects should provide each constructor with the name
    // of its property on the original object.
    //
    if (obj) options.name = entity;

    //
    // Run the functions, traverse will handle init.
    //
    if (js(base)) {
      return stack.concat(init(
        base,
        'string' === is(name) ? name : '',
        options
      ));
    }

    //
    // When we've been supplied with an array as base assume we want to keep it
    // as array and do not want it to be merged.
    //
    if (Array.isArray(base)) {
      options.name = name; // Force the name of the entry for all items in array.
      stack.push(traverse(base, options));

      return stack;
    }

    return stack.concat(traverse(base, options));
  };
}
function iterator ( traverse , obj , options ) { return function reduce ( stack , entity ) { var base = obj ? obj [ entity ] : entity , name = options . name || entity ; // // Fabricated objects should provide each constructor with the name // of its property on the original object. // if ( obj ) options . name = entity ; // // Run the functions, traverse will handle init. // if ( js ( base ) ) { return stack . concat ( init ( base , 'string' === is ( name ) ? name : '' , options ) ) ; } // // When we've been supplied with an array as base assume we want to keep it // as array and do not want it to be merged. // if ( Array . isArray ( base ) ) { options . name = name ; // Force the name of the entry for all items in array. stack . push ( traverse ( base , options ) ) ; return stack ; } return stack . concat ( traverse ( base , options ) ) ; } ; }
Return iterator for array or object.

@param {Function} traverse Recursive iterator, called on directories.
@param {Object} obj Original object, if set values are fetched by entity.
@param {Object} options Configuration.
@return {Function} iterator
@api private
Return iterator for array or object .