functions/node_modules/googleapis/build/src/lib/discovery.js
/**
 * Given a schema, add methods and resources to a target.
 *
 * @private
 * @param {object} target The target to which to apply the schema.
 * @param {object} rootSchema The top-level schema, so we don't lose track of it
 * during recursion.
 * @param {object} schema The current schema from which to extract methods and
 * resources.
 * @param {object} context The context to add to each method.
 */
Given a schema, add methods and resources to a target.
@private
@param {object} target The target to which to apply the schema.
@param {object} rootSchema The top-level schema, so we don't lose track of it
during recursion.
@param {object} schema The current schema from which to extract methods and
resources.
@param {object} context The context to add to each method.
Given a schema add methods and resources to a target . @private @param { object } target The target to which to apply the schema . @param { object } rootSchema The top - level schema so we don ' t lose track of it during recursion . @param { object } schema The current schema from which to extract methods and resources . @param { object } context The context to add to each method .
function applySchema(target, rootSchema, schema, context) {
    applyMethodsFromSchema(target, rootSchema, schema, context);
    if (schema.resources) {
        for (var resourceName in schema.resources) {
            if (schema.resources.hasOwnProperty(resourceName)) {
                var resource = schema.resources[resourceName];
                if (!target[resourceName]) {
                    target[resourceName] = {};
                }
                applySchema(target[resourceName], rootSchema, resource, context);
            }
        }
    }
}
function applySchema ( target , rootSchema , schema , context ) { applyMethodsFromSchema ( target , rootSchema , schema , context ) ; if ( schema . resources ) { for ( var resourceName in schema . resources ) { if ( schema . resources . hasOwnProperty ( resourceName ) ) { var resource = schema . resources [ resourceName ] ; if ( ! target [ resourceName ] ) { target [ resourceName ] = { } ; } applySchema ( target [ resourceName ] , rootSchema , resource , context ) ; } } } }
Given a schema, add methods and resources to a target.
Given a schema add methods and resources to a target .