How to use the has function from underscore
Find comprehensive JavaScript underscore.has code examples handpicked from public code repositorys.
GitHub: gmuteam/jsbint
2673 2674 2675 2676 2677 2678 2679 2680 2681
x.nud = function () { var b, f, i, p, t, exp, t1, t2; var props = {}; // All properties, including accessors function saveProperty(name, tkn) { if (props[name] && _.has(props, name)) warning("W075", state.tokens.next, i); else props[name] = {};
12
11
2
+ 11 other calls in file
GitHub: GeraldWodni/kern.js
61 62 63 64 65 66 67 68 69
}); } function read( key, callback ) { var values = [ opts.table, opts.key, key ]; if( _.has( key, "key" ) ) { values = key; values.values = [ opts.table, opts.key, key.key ]; }
3
9
1
+ 29 other calls in file
2187 2188 2189 2190 2191 2192 2193 2194 2195 2196
// Counts instances of an object that group by a certain criterion. Pass // either a string attribute to count by, or a function that returns the // criterion. _.countBy = group(function(result, key) { _.has(result, key) ? result[key]++ : result[key] = 1; }); // Use a comparator function to figure out the smallest index at which // an object should be inserted so as to maintain order. Uses binary search.
0
2
0
+ 4 other calls in file
GitHub: peerlibrary/meteor
169 170 171 172 173 174 175 176 177 178
_.extend(OutputLog.prototype, { write: function (channel, text) { var self = this; if (! _.has(self.buffers, 'channel')) self.buffers[channel] = { text: '', offset: 0}; var b = self.buffers[channel]; while (text.length) {
0
2
28
GitHub: ArVinD-005/RepoA
1176 1177 1178 1179 1180 1181 1182 1183 1184 1185
for (var key in a) { if (_.has(a, key)) { // Count the expected number of properties. size++; // Deep compare each member. if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break; } } // Ensure that both objects contain the same number of properties. if (result) {
0
0
1
+ 20 other calls in file
GitHub: mediabuff/gecko
6995 6996 6997 6998 6999 7000 7001 7002 7003 7004
} }, current: { has: function (t) { return _.has(_current, t); }, add: function (t, type, tok) { _current[t] = { "(type)" : type, "(token)": tok };
0
0
1
+ 23 other calls in file
115 116 117 118 119 120 121 122 123 124 125
}, []).join('.'); if (_.isEmpty(remainingPath)) { return obj ? obj[nPath] : fallback; } else { return _.has(obj, nPath) && get(obj[nPath], remainingPath); } } };
0
0
1
+ 5 other calls in file
1360 1361 1362 1363 1364 1365 1366 1367 1368 1369
return Base64.decode(obj.$binary); } }, { // Escaping one level matchJSONValue: function (obj) { return _.has(obj, '$escape') && _.size(obj) === 1; }, matchObject: function (obj) { if (_.isEmpty(obj) || _.size(obj) > 2) { return false;
0
0
0
+ 15 other calls in file
GitHub: haithemhaamdi/AzureAD
101 102 103 104 105 106 107 108 109 110
* @memberOf XmlUtil * @param {object} node An xml dom node. * @return {Boolean} true if the node represents an element. */ isElementNode : function(node) { return _.has(node, 'tagName'); }, /** * Given an xmldom node this function returns any text data contained within.
0
0
0
470 471 472 473 474 475 476 477 478 479 480
* @param {object} entry The entry to check * @return {bool} Returns true if the entry has already been augmented * with cache metadata. */ CacheDriver.prototype._entryHasMetadata = function(entry) { return (_.has(entry, METADATA_CLIENTID) && _.has(entry, METADATA_AUTHORITY)); }; CacheDriver.prototype._augmentEntryWithCacheMetadata = function(entry) { if (this._entryHasMetadata(entry)) {
0
0
0
GitHub: netanelgilad/meteor
231 232 233 234 235 236 237 238 239
} var target = commands; while (nameParts.length > 1) { var part = nameParts.shift(); if (! _.has(target, part)) target[part] = {}; target = target[part]; }
0
0
1
+ 11 other calls in file
21 22 23 24 25 26 27 28 29 30
// disableOplog var Runner = function (options) { var self = this; self.projectContext = options.projectContext; if (! _.has(options, 'proxyPort')) throw new Error("no proxyPort?"); var listenPort = options.proxyPort; var mongoPort = parseInt(listenPort) + 1;
0
0
1
+ 7 other calls in file
211 212 213 214 215 216 217 218 219
var match = h.match(/^([^=\s]+)=([^;\s]+)/); if (match) setCookie[match[1]] = match[2]; }); if (useSessionHeader && _.has(response.headers, "x-meteor-session")) { auth.setSessionId(config.getAccountsDomain(), response.headers['x-meteor-session']); }
0
0
2
underscore.keys is the most popular function in underscore (11266 examples)