Lines Matching refs:_

19   var previousUnderscore = root._;
41 var _ = function(obj) { class
42 if (obj instanceof _) return obj;
43 if (!(this instanceof _)) return new _(obj);
54 exports = module.exports = _;
56 exports._ = _;
58 root._ = _;
62 _.VERSION = '1.8.3';
93 if (_.iteratee !== builtinIteratee) return _.iteratee(value, context);
94 if (value == null) return _.identity;
95 if (_.isFunction(value)) return optimizeCb(value, context, argCount);
96 if (_.isObject(value)) return _.matcher(value);
97 return _.property(value);
103 _.iteratee = builtinIteratee = function(value, context) {
133 if (!_.isObject(prototype)) return {};
164 _.each = _.forEach = function(obj, iteratee, context) {
172 var keys = _.keys(obj);
181 _.map = _.collect = function(obj, iteratee, context) {
183 var keys = !isArrayLike(obj) && _.keys(obj),
198 var keys = !isArrayLike(obj) && _.keys(obj),
220 _.reduce = _.foldl = _.inject = createReduce(1);
223 _.reduceRight = _.foldr = createReduce(-1);
226 _.find = _.detect = function(obj, predicate, context) {
227 var keyFinder = isArrayLike(obj) ? _.findIndex : _.findKey;
234 _.filter = _.select = function(obj, predicate, context) {
237 _.each(obj, function(value, index, list) {
244 _.reject = function(obj, predicate, context) {
245 return _.filter(obj, _.negate(cb(predicate)), context);
250 _.every = _.all = function(obj, predicate, context) {
252 var keys = !isArrayLike(obj) && _.keys(obj),
263 _.some = _.any = function(obj, predicate, context) {
265 var keys = !isArrayLike(obj) && _.keys(obj),
276 _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {
277 if (!isArrayLike(obj)) obj = _.values(obj);
279 return _.indexOf(obj, item, fromIndex) >= 0;
283 _.invoke = restArgs(function(obj, method, args) {
284 var isFunc = _.isFunction(method);
285 return _.map(obj, function(value) {
292 _.pluck = function(obj, key) {
293 return _.map(obj, _.property(key));
298 _.where = function(obj, attrs) {
299 return _.filter(obj, _.matcher(attrs));
304 _.findWhere = function(obj, attrs) {
305 return _.find(obj, _.matcher(attrs));
309 _.max = function(obj, iteratee, context) {
313 obj = isArrayLike(obj) ? obj : _.values(obj);
322 _.each(obj, function(v, index, list) {
334 _.min = function(obj, iteratee, context) {
338 obj = isArrayLike(obj) ? obj : _.values(obj);
347 _.each(obj, function(v, index, list) {
359 _.shuffle = function(obj) {
360 return _.sample(obj, Infinity);
367 _.sample = function(obj, n, guard) {
369 if (!isArrayLike(obj)) obj = _.values(obj);
370 return obj[_.random(obj.length - 1)];
372 var sample = isArrayLike(obj) ? _.clone(obj) : _.values(obj);
377 var rand = _.random(index, last);
386 _.sortBy = function(obj, iteratee, context) {
389 return _.pluck(_.map(obj, function(value, key, list) {
411 _.each(obj, function(value, index) {
421 _.groupBy = group(function(result, value, key) {
422 if (_.has(result, key)) result[key].push(value); else result[key] = [value];
427 _.indexBy = group(function(result, value, key) {
434 _.countBy = group(function(result, value, key) {
435 if (_.has(result, key)) result[key]++; else result[key] = 1;
440 _.toArray = function(obj) {
442 if (_.isArray(obj)) return slice.call(obj);
443 if (_.isString(obj)) {
447 if (isArrayLike(obj)) return _.map(obj, _.identity);
448 return _.values(obj);
452 _.size = function(obj) {
454 return isArrayLike(obj) ? obj.length : _.keys(obj).length;
459 _.partition = group(function(result, value, pass) {
469 _.first = _.head = _.take = function(array, n, guard) {
472 return _.initial(array, array.length - n);
478 _.initial = function(array, n, guard) {
484 _.last = function(array, n, guard) {
487 return _.rest(array, Math.max(0, array.length - n));
493 _.rest = _.tail = _.drop = function(array, n, guard) {
498 _.compact = function(array) {
499 return _.filter(array, Boolean);
508 if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
525 _.flatten = function(array, shallow) {
530 _.without = restArgs(function(array, otherArrays) {
531 return _.difference(array, otherArrays);
537 _.uniq = _.unique = function(array, isSorted, iteratee, context) {
538 if (!_.isBoolean(isSorted)) {
553 if (!_.contains(seen, computed)) {
557 } else if (!_.contains(result, value)) {
566 _.union = restArgs(function(arrays) {
567 return _.uniq(flatten(arrays, true, true));
572 _.intersection = function(array) {
577 if (_.contains(result, item)) continue;
580 if (!_.contains(arguments[j], item)) break;
589 _.difference = restArgs(function(array, rest) {
591 return _.filter(array, function(value){
592 return !_.contains(rest, value);
598 _.unzip = function(array) {
599 var length = array && _.max(array, getLength).length || 0;
603 result[index] = _.pluck(array, index);
610 _.zip = restArgs(_.unzip);
615 _.object = function(list, values) {
641 _.findIndex = createPredicateIndexFinder(1);
642 _.findLastIndex = createPredicateIndexFinder(-1);
646 _.sortedIndex = function(array, obj, iteratee, context) {
672 idx = predicateFind(slice.call(array, i, length), _.isNaN);
686 _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);
687 _.lastIndexOf = createIndexFinder(-1, _.findLastIndex);
692 _.range = function(start, stop, step) {
713 _.chunk = function(array, count) {
733 if (_.isObject(result)) return result;
740 _.bind = restArgs(function(func, context, args) {
741 if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
752 _.partial = restArgs(function(func, boundArgs) {
753 var placeholder = _.partial.placeholder;
766 _.partial.placeholder = _;
771 _.bindAll = restArgs(function(obj, keys) {
777 obj[key] = _.bind(obj[key], obj);
782 _.memoize = function(func, hasher) {
786 if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
795 _.delay = restArgs(function(func, wait, args) {
803 _.defer = _.partial(_.delay, _, 1);
810 _.throttle = function(func, wait, options) {
816 previous = options.leading === false ? 0 : _.now();
823 var now = _.now();
855 _.debounce = function(func, wait, immediate) {
870 timeout = _.delay(later, wait, this, args);
887 _.wrap = function(func, wrapper) {
888 return _.partial(wrapper, func);
892 _.negate = function(predicate) {
900 _.compose = function() {
912 _.after = function(times, func) {
921 _.before = function(times, func) {
934 _.once = _.partial(_.before, 2);
936 _.restArgs = restArgs;
949 var proto = _.isFunction(constructor) && constructor.prototype || ObjProto;
953 if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);
957 if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {
965 _.keys = function(obj) {
966 if (!_.isObject(obj)) return [];
969 for (var key in obj) if (_.has(obj, key)) keys.push(key);
976 _.allKeys = function(obj) {
977 if (!_.isObject(obj)) return [];
986 _.values = function(obj) {
987 var keys = _.keys(obj);
998 _.mapObject = function(obj, iteratee, context) {
1000 var keys = _.keys(obj),
1011 _.pairs = function(obj) {
1012 var keys = _.keys(obj);
1022 _.invert = function(obj) {
1024 var keys = _.keys(obj);
1033 _.functions = _.methods = function(obj) {
1036 if (_.isFunction(obj[key])) names.push(key);
1061 _.extend = createAssigner(_.allKeys);
1065 _.extendOwn = _.assign = createAssigner(_.keys);
1068 _.findKey = function(obj, predicate, context) {
1070 var keys = _.keys(obj), key;
1083 _.pick = restArgs(function(obj, keys) {
1086 if (_.isFunction(iteratee)) {
1088 keys = _.allKeys(obj);
1103 _.omit = restArgs(function(obj, keys) {
1105 if (_.isFunction(iteratee)) {
1106 iteratee = _.negate(iteratee);
1109 keys = _.map(flatten(keys, false, false), String);
1111 return !_.contains(keys, key);
1114 return _.pick(obj, iteratee, context);
1118 _.defaults = createAssigner(_.allKeys, true);
1123 _.create = function(prototype, props) {
1125 if (props) _.extendOwn(result, props);
1130 _.clone = function(obj) {
1131 if (!_.isObject(obj)) return obj;
1132 return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
1138 _.tap = function(obj, interceptor) {
1144 _.isMatch = function(object, attrs) {
1145 var keys = _.keys(attrs), length = keys.length;
1175 if (a instanceof _) a = a._wrapped;
1176 if (b instanceof _) b = b._wrapped;
1211 if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
1212 _.isFunction(bCtor) && bCtor instanceof bCtor)
1246 var keys = _.keys(a), key;
1249 if (_.keys(b).length !== length) return false;
1253 if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
1263 _.isEqual = function(a, b) {
1269 _.isEmpty = function(obj) {
1271 …if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.leng…
1272 return _.keys(obj).length === 0;
1276 _.isElement = function(obj) {
1282 _.isArray = nativeIsArray || function(obj) {
1287 _.isObject = function(obj) {
1293_.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error', 'Symbol', 'Map', '…
1294 _['is' + name] = function(obj) { function
1301 if (!_.isArguments(arguments)) {
1302 _.isArguments = function(obj) {
1303 return _.has(obj, 'callee');
1311 _.isFunction = function(obj) {
1317 _.isFinite = function(obj) {
1318 return !_.isSymbol(obj) && isFinite(obj) && !isNaN(parseFloat(obj));
1322 _.isNaN = function(obj) {
1323 return _.isNumber(obj) && isNaN(obj);
1327 _.isBoolean = function(obj) {
1332 _.isNull = function(obj) {
1337 _.isUndefined = function(obj) {
1343 _.has = function(obj, key) {
1352 _.noConflict = function() {
1353 root._ = previousUnderscore;
1358 _.identity = function(value) {
1363 _.constant = function(value) {
1369 _.noop = function(){};
1371 _.property = property;
1374 _.propertyOf = function(obj) {
1382 _.matcher = _.matches = function(attrs) {
1383 attrs = _.extendOwn({}, attrs);
1385 return _.isMatch(obj, attrs);
1390 _.times = function(n, iteratee, context) {
1398 _.random = function(min, max) {
1407 _.now = Date.now || function() {
1420 var unescapeMap = _.invert(escapeMap);
1428 var source = '(?:' + _.keys(map).join('|') + ')';
1436 _.escape = createEscaper(escapeMap);
1437 _.unescape = createEscaper(unescapeMap);
1441 _.result = function(object, prop, fallback) {
1446 return _.isFunction(value) ? value.call(object) : value;
1452 _.uniqueId = function(prefix) {
1459 _.templateSettings = {
1491 _.template = function(text, settings, oldSettings) {
1493 settings = _.defaults({}, settings, _.templateSettings);
1538 return render.call(this, data, _);
1549 _.chain = function(obj) {
1550 var instance = _(obj);
1563 return instance._chain ? _(obj).chain() : obj;
1567 _.mixin = function(obj) {
1568 _.each(_.functions(obj), function(name) {
1569 var func = _[name] = obj[name];
1570 _.prototype[name] = function() { function
1573 return chainResult(this, func.apply(_, args));
1576 return _;
1580 _.mixin(_);
1583 _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
1585 _.prototype[name] = function() {
1594 _.each(['concat', 'join', 'slice'], function(name) {
1596 _.prototype[name] = function() {
1602 _.prototype.value = function() {
1608 _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
1610 _.prototype.toString = function() {
1623 return _;