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 | 1x 1x | let log = require('./service.log');
/**
* Gets a properly formatted LDAP compound filter. This is a very simple approach to ensure that the LDAP
* compound filter is wrapped with an enclosing () if necessary. It does not handle parsing of an existing
* compound ldap filter.
* @param {String} filter The LDAP filter to inspect.
* @returns {String}
*/
function getCompoundFilter(filter) {
log.trace('getCompoundFilter(%s)', filter);
if (!filter) return (false);
if ((filter.charAt(0) === '(') && (filter.charAt(filter.length - 1) === ')')) {
return (filter);
}
return ('(' + filter + ')');
}
module.exports = getCompoundFilter; |