All files / node-activedirectory/lib/services/internal service.includeGroupMembershipFor.js

30% Statements 3/10
0% Branches 0/11
0% Functions 0/2
30% Lines 3/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 231x                 1x                         1x
const _                 = require('underscore');
 
/**
 * Checks to see if group membership for the specified type is enabled.
 *
 * @param {Object} [opts] The options to inspect. If not specified, uses this.opts.
 * @param {String} name The name of the membership value to inspect. Values: (all|user|group)
 * @returns {Boolean} True if the specified membership is enabled.
 */
const includeGroupMembershipFor = function(opts, name){
    if (typeof (opts) === 'string') {
        name = opts;
        opts = this.opts;
    }
 
    var lowerCaseName = (name || '').toLowerCase();
    return (_.any(((opts || this.opts || {}).includeMembership || []), function (i) {
        i = i.toLowerCase();
        return ((i === 'all') || (i === lowerCaseName));
    }));
}
 
module.exports = includeGroupMembershipFor;