UNPKG

399 BJavaScriptView Raw
1'use strict';
2
3/**
4 * Return true if `key` is an own, enumerable property
5 * of the given `obj`.
6 *
7 * @param {Object} `object`
8 * @param {String} `key`
9 * @return {Boolean}
10 * @api public
11 */
12
13exports._if = function if_(fn, a, b, thisArg) {
14 if (typeof fn !== 'function') return '';
15
16 thisArg = thisArg || this || null;
17 var res = fn.call(thisArg, a, b);
18
19 if (res) return a;
20 return b;
21};
22