lib/normalizers/v1.js
function (entityV1, options) {
        if (!entityV1) { return; }

        var auth,
            params,
            mapper,
            currentHelper,
            helperAttributes,
            prioritizeV2 = this.options.prioritizeV2;

        // if prioritize v2 is true, use auth as the source of truth
        if (util.notLegacy(entityV1, 'auth') || (entityV1.auth && prioritizeV2)) {
            return util.sanitizeAuthArray(entityV1, options);
        }
        if ((entityV1.currentHelper === null) || (entityV1.currentHelper === 'normal')) { return null; }

        currentHelper = entityV1.currentHelper;
        helperAttributes = entityV1.helperAttributes;

        // if noDefaults is false and there is no currentHelper, bail out
        if (!(currentHelper || this.options.noDefaults)) { return; }
        // if there is a currentHelper without helperAttributes, bail out.
        if (currentHelper && !helperAttributes) { return this.options.noDefaults ? undefined : null; }

        !currentHelper && (currentHelper = authIdMap[helperAttributes && helperAttributes.id]);
        auth = { type: v1Common.authMap[currentHelper] };
        mapper = util.authMappersFromLegacy[currentHelper];

        // @todo: Change this to support custom auth helpers
        mapper && helperAttributes && (params = mapper(helperAttributes)) && (auth[auth.type] = params);

        return util.authMapToArray({ auth: auth }, options);
    }
function (entityV1, options) {
        if (!entityV1) { return; }

        var auth,
            params,
            mapper,
            currentHelper,
            helperAttributes,
            prioritizeV2 = this.options.prioritizeV2;

        // if prioritize v2 is true, use auth as the source of truth
        if (util.notLegacy(entityV1, 'auth') || (entityV1.auth && prioritizeV2)) {
            return util.sanitizeAuthArray(entityV1, options);
        }
        if ((entityV1.currentHelper === null) || (entityV1.currentHelper === 'normal')) { return null; }

        currentHelper = entityV1.currentHelper;
        helperAttributes = entityV1.helperAttributes;

        // if noDefaults is false and there is no currentHelper, bail out
        if (!(currentHelper || this.options.noDefaults)) { return; }
        // if there is a currentHelper without helperAttributes, bail out.
        if (currentHelper && !helperAttributes) { return this.options.noDefaults ? undefined : null; }

        !currentHelper && (currentHelper = authIdMap[helperAttributes && helperAttributes.id]);
        auth = { type: v1Common.authMap[currentHelper] };
        mapper = util.authMappersFromLegacy[currentHelper];

        // @todo: Change this to support custom auth helpers
        mapper && helperAttributes && (params = mapper(helperAttributes)) && (auth[auth.type] = params);

        return util.authMapToArray({ auth: auth }, options);
    }
function ( entityV1 , options ) { if ( ! entityV1 ) { return ; } var auth , params , mapper , currentHelper , helperAttributes , prioritizeV2 = this . options . prioritizeV2 ; // if prioritize v2 is true, use auth as the source of truth if ( util . notLegacy ( entityV1 , 'auth' ) || ( entityV1 . auth && prioritizeV2 ) ) { return util . sanitizeAuthArray ( entityV1 , options ) ; } if ( ( entityV1 . currentHelper === null ) || ( entityV1 . currentHelper === 'normal' ) ) { return null ; } currentHelper = entityV1 . currentHelper ; helperAttributes = entityV1 . helperAttributes ; // if noDefaults is false and there is no currentHelper, bail out if ( ! ( currentHelper || this . options . noDefaults ) ) { return ; } // if there is a currentHelper without helperAttributes, bail out. if ( currentHelper && ! helperAttributes ) { return this . options . noDefaults ? undefined : null ; } ! currentHelper && ( currentHelper = authIdMap [ helperAttributes && helperAttributes . id ] ) ; auth = { type : v1Common . authMap [ currentHelper ] } ; mapper = util . authMappersFromLegacy [ currentHelper ] ; // @todo: Change this to support custom auth helpers mapper && helperAttributes && ( params = mapper ( helperAttributes ) ) && ( auth [ auth . type ] = params ) ; return util . authMapToArray ( { auth : auth } , options ) ; }
Normalizes inherited v1 auth manifests.

@param {Object} entityV1 - A v1 compliant wrapped auth manifest.
@param {?Object} options - The set of options for the current auth cleansing operation.
@param {?Boolean} [options.includeNoauth=false] - When set to true, noauth is set to ''.

@returns {Object} - A v1 compliant set of auth helper attributes.
Normalizes inherited v1 auth manifests .