function buildFilter(filter, def) {
	if (!filter) return function() { return def; };

	if (typeof filter === 'string') {
				var re = new RegExp(filter);
				return re.test.bind(re);
	}

	if (Array.isArray(filter)) {
		var regs = filter.map(function(i) {
			if (typeof i === 'string')
				var re = new RegExp(i);
				return re.test.bind(re);
			return i;
		});
		return function(v) {
			return regs.some(function(e) {
				return e(v);
			});
		}
	};
	return filter;
}
/**
 * Build filter test function.
 * String or array of strings is evaluated as regexps test.
 * If filter is false then `def` value is always returned.
 * If filter is function then it's used as is.
 */
Build filter test function.
String or array of strings is evaluated as regexps test.
If filter is false then `def` value is always returned.
If filter is function then it's used as is.
Build filter test function . String or array of strings is evaluated as regexps test . If filter is false then ` def ` value is always returned . If filter is function then it ' s used as is .
function buildFilter(filter, def) {
	if (!filter) return function() { return def; };
	if (typeof filter === 'string') {
				var re = new RegExp(filter);
				return re.test.bind(re);
	}
	if (Array.isArray(filter)) {
		var regs = filter.map(function(i) {
			if (typeof i === 'string')
				var re = new RegExp(i);
				return re.test.bind(re);
			return i;
		});
		return function(v) {
			return regs.some(function(e) {
				return e(v);
			});
		}
	};
	return filter;
}
function buildFilter ( filter , def ) { if ( ! filter ) return function ( ) { return def ; } ; if ( typeof filter === 'string' ) { var re = new RegExp ( filter ) ; return re . test . bind ( re ) ; } if ( Array . isArray ( filter ) ) { var regs = filter . map ( function ( i ) { if ( typeof i === 'string' ) var re = new RegExp ( i ) ; return re . test . bind ( re ) ; return i ; } ) ; return function ( v ) { return regs . some ( function ( e ) { return e ( v ) ; } ) ; } } ; return filter ; }
Build filter test function.
Build filter test function .