function inferAlias(options, source) {
    options = __assign({}, options);
    if (!options.include) {
        return options;
    }
    // if include is not an array, wrap in an array
    if (!Array.isArray(options.include)) {
        options.include = [options.include];
    }
    else if (!options.include.length) {
        return options;
    }
    // convert all included elements to { model: Model } form
    options.include = options.include.map(function (include) {
        include = inferAliasForInclude(include, source);
        return include;
    });
    return options;
}
/**
 * Pre conform includes, so that "as" value can be inferred from source
 */
Pre conform includes, so that "as" value can be inferred from source
Pre conform includes so that " as " value can be inferred from source
function inferAlias(options, source) {
    options = __assign({}, options);
    if (!options.include) {
        return options;
    }
    if (!Array.isArray(options.include)) {
        options.include = [options.include];
    }
    else if (!options.include.length) {
        return options;
    }
    options.include = options.include.map(function (include) {
        include = inferAliasForInclude(include, source);
        return include;
    });
    return options;
}
function inferAlias ( options , source ) { options = __assign ( { } , options ) ; if ( ! options . include ) { return options ; } if ( ! Array . isArray ( options . include ) ) { options . include = [ options . include ] ; } else if ( ! options . include . length ) { return options ; } options . include = options . include . map ( function ( include ) { include = inferAliasForInclude ( include , source ) ; return include ; } ) ; return options ; }
Pre conform includes, so that "as" value can be inferred from source
Pre conform includes so that " as " value can be inferred from source
// if include is not an array, wrap in an array // convert all included elements to { model: Model } form