lib/util.js
function (entity, options) {
        !options && (options = {});

        var auth = entity && entity.auth;

        if (auth === null) { return null; } // eslint-disable-line security/detect-possible-timing-attacks
        if (!(auth && auth.type)) { return; }
        if (auth.type === 'noauth') {
            return options.excludeNoauth ? null : { type: 'noauth' };
        }

        return auth;
    }
function (entity, options) {
        !options && (options = {});

        var auth = entity && entity.auth;

        if (auth === null) { return null; } // eslint-disable-line security/detect-possible-timing-attacks
        if (!(auth && auth.type)) { return; }
        if (auth.type === 'noauth') {
            return options.excludeNoauth ? null : { type: 'noauth' };
        }

        return auth;
    }
function ( entity , options ) { ! options && ( options = { } ) ; var auth = entity && entity . auth ; if ( auth === null ) { return null ; } // eslint-disable-line security/detect-possible-timing-attacks if ( ! ( auth && auth . type ) ) { return ; } if ( auth . type === 'noauth' ) { return options . excludeNoauth ? null : { type : 'noauth' } ; } return auth ; }
Performs auth cleansing common to all sorts of auth transformations.

@param {Object} entity - The wrapped auth entity to be cleaned.
@param {?Object} options - The set of options for the current auth cleansing operation.
@param {?Boolean} [options.excludeNoauth=false] - When set to true, noauth is set to null.
@returns {Object|*} - The processed auth data.
Performs auth cleansing common to all sorts of auth transformations .