src/client/factory.js
function createProxies(config, map, parentPath) {
  parentPath = parentPath || [];

  var isBase = parentPath.length === 0;
  var proxies = {};
  var path;

  for (var key in map) {
    if (map.hasOwnProperty(key)) {
      if (isObject(map[key])) {
        proxies[key] = createProxies(config, map[key], parentPath.concat([key]));
      }
      else if (isBoolean(map[key])) {
        path = parentPath.join('/') + (isBase ? '' : '/') + key;
        proxies[key] = createProxiedMethod(config, path);
      }
    }
  }

  return proxies;
}
function createProxies(config, map, parentPath) {
  parentPath = parentPath || [];

  var isBase = parentPath.length === 0;
  var proxies = {};
  var path;

  for (var key in map) {
    if (map.hasOwnProperty(key)) {
      if (isObject(map[key])) {
        proxies[key] = createProxies(config, map[key], parentPath.concat([key]));
      }
      else if (isBoolean(map[key])) {
        path = parentPath.join('/') + (isBase ? '' : '/') + key;
        proxies[key] = createProxiedMethod(config, path);
      }
    }
  }

  return proxies;
}
function createProxies ( config , map , parentPath ) { parentPath = parentPath || [ ] ; var isBase = parentPath . length === 0 ; var proxies = { } ; var path ; for ( var key in map ) { if ( map . hasOwnProperty ( key ) ) { if ( isObject ( map [ key ] ) ) { proxies [ key ] = createProxies ( config , map [ key ] , parentPath . concat ( [ key ] ) ) ; } else if ( isBoolean ( map [ key ] ) ) { path = parentPath . join ( '/' ) + ( isBase ? '' : '/' ) + key ; proxies [ key ] = createProxiedMethod ( config , path ) ; } } } return proxies ; }
Creates proxied methods using a provided map. If parentPath is provided,
it will be used to build the proxied method's endpoint.
@param  {Object}  map         The entity map to use.
@param  {Array}   parentPath  The path to the parent entity.
Creates proxied methods using a provided map . If parentPath is provided it will be used to build the proxied method s endpoint .