Lines Matching refs:_

15   var previousUnderscore = root._;
39 var _ = function(obj) { class
40 if (obj instanceof _) return obj;
41 if (!(this instanceof _)) return new _(obj);
50 exports = module.exports = _;
52 exports._ = _;
54 root._ = _;
58 _.VERSION = '1.8.3';
88 if (value == null) return _.identity;
89 if (_.isFunction(value)) return optimizeCb(value, context, argCount);
90 if (_.isObject(value)) return _.matcher(value);
91 return _.property(value);
93 _.iteratee = function(value, context) {
117 if (!_.isObject(prototype)) return {};
148 _.each = _.forEach = function(obj, iteratee, context) {
156 var keys = _.keys(obj);
165 _.map = _.collect = function(obj, iteratee, context) {
167 var keys = !isArrayLike(obj) && _.keys(obj),
191 var keys = !isArrayLike(obj) && _.keys(obj),
205 _.reduce = _.foldl = _.inject = createReduce(1);
208 _.reduceRight = _.foldr = createReduce(-1);
211 _.find = _.detect = function(obj, predicate, context) {
214 key = _.findIndex(obj, predicate, context);
216 key = _.findKey(obj, predicate, context);
223 _.filter = _.select = function(obj, predicate, context) {
226 _.each(obj, function(value, index, list) {
233 _.reject = function(obj, predicate, context) {
234 return _.filter(obj, _.negate(cb(predicate)), context);
239 _.every = _.all = function(obj, predicate, context) {
241 var keys = !isArrayLike(obj) && _.keys(obj),
252 _.some = _.any = function(obj, predicate, context) {
254 var keys = !isArrayLike(obj) && _.keys(obj),
265 _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {
266 if (!isArrayLike(obj)) obj = _.values(obj);
268 return _.indexOf(obj, item, fromIndex) >= 0;
272 _.invoke = function(obj, method) {
274 var isFunc = _.isFunction(method);
275 return _.map(obj, function(value) {
282 _.pluck = function(obj, key) {
283 return _.map(obj, _.property(key));
288 _.where = function(obj, attrs) {
289 return _.filter(obj, _.matcher(attrs));
294 _.findWhere = function(obj, attrs) {
295 return _.find(obj, _.matcher(attrs));
299 _.max = function(obj, iteratee, context) {
303 obj = isArrayLike(obj) ? obj : _.values(obj);
312 _.each(obj, function(value, index, list) {
324 _.min = function(obj, iteratee, context) {
328 obj = isArrayLike(obj) ? obj : _.values(obj);
337 _.each(obj, function(value, index, list) {
350 _.shuffle = function(obj) {
351 var set = isArrayLike(obj) ? obj : _.values(obj);
355 rand = _.random(0, index);
365 _.sample = function(obj, n, guard) {
367 if (!isArrayLike(obj)) obj = _.values(obj);
368 return obj[_.random(obj.length - 1)];
370 return _.shuffle(obj).slice(0, Math.max(0, n));
374 _.sortBy = function(obj, iteratee, context) {
376 return _.pluck(_.map(obj, function(value, index, list) {
398 _.each(obj, function(value, index) {
408 _.groupBy = group(function(result, value, key) {
409 if (_.has(result, key)) result[key].push(value); else result[key] = [value];
414 _.indexBy = group(function(result, value, key) {
421 _.countBy = group(function(result, value, key) {
422 if (_.has(result, key)) result[key]++; else result[key] = 1;
426 _.toArray = function(obj) {
428 if (_.isArray(obj)) return slice.call(obj);
429 if (isArrayLike(obj)) return _.map(obj, _.identity);
430 return _.values(obj);
434 _.size = function(obj) {
436 return isArrayLike(obj) ? obj.length : _.keys(obj).length;
441 _.partition = function(obj, predicate, context) {
444 _.each(obj, function(value, key, obj) {
456 _.first = _.head = _.take = function(array, n, guard) {
459 return _.initial(array, array.length - n);
465 _.initial = function(array, n, guard) {
471 _.last = function(array, n, guard) {
474 return _.rest(array, Math.max(0, array.length - n));
480 _.rest = _.tail = _.drop = function(array, n, guard) {
485 _.compact = function(array) {
486 return _.filter(array, _.identity);
494 if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
510 _.flatten = function(array, shallow) {
515 _.without = function(array) {
516 return _.difference(array, slice.call(arguments, 1));
522 _.uniq = _.unique = function(array, isSorted, iteratee, context) {
523 if (!_.isBoolean(isSorted)) {
538 if (!_.contains(seen, computed)) {
542 } else if (!_.contains(result, value)) {
551 _.union = function() {
552 return _.uniq(flatten(arguments, true, true));
557 _.intersection = function(array) {
562 if (_.contains(result, item)) continue;
564 if (!_.contains(arguments[j], item)) break;
573 _.difference = function(array) {
575 return _.filter(array, function(value){
576 return !_.contains(rest, value);
582 _.zip = function() {
583 return _.unzip(arguments);
588 _.unzip = function(array) {
589 var length = array && _.max(array, getLength).length || 0;
593 result[index] = _.pluck(array, index);
601 _.object = function(list, values) {
627 _.findIndex = createPredicateIndexFinder(1);
628 _.findLastIndex = createPredicateIndexFinder(-1);
632 _.sortedIndex = function(array, obj, iteratee, context) {
658 idx = predicateFind(slice.call(array, i, length), _.isNaN);
672 _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);
673 _.lastIndexOf = createIndexFinder(-1, _.findLastIndex);
678 _.range = function(start, stop, step) {
704 if (_.isObject(result)) return result;
711 _.bind = function(func, context) {
713 if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
724 _.partial = function(func) {
730 args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i];
741 _.bindAll = function(obj) {
746 obj[key] = _.bind(obj[key], obj);
752 _.memoize = function(func, hasher) {
756 if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
765 _.delay = function(func, wait) {
774 _.defer = _.partial(_.delay, _, 1);
781 _.throttle = function(func, wait, options) {
787 previous = options.leading === false ? 0 : _.now();
793 var now = _.now();
817 _.debounce = function(func, wait, immediate) {
821 var last = _.now() - timestamp;
837 timestamp = _.now();
852 _.wrap = function(func, wrapper) {
853 return _.partial(wrapper, func);
857 _.negate = function(predicate) {
865 _.compose = function() {
877 _.after = function(times, func) {
886 _.before = function(times, func) {
899 _.once = _.partial(_.before, 2);
912 var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto;
916 if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);
920 if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {
928 _.keys = function(obj) {
929 if (!_.isObject(obj)) return [];
932 for (var key in obj) if (_.has(obj, key)) keys.push(key);
939 _.allKeys = function(obj) {
940 if (!_.isObject(obj)) return [];
949 _.values = function(obj) {
950 var keys = _.keys(obj);
961 _.mapObject = function(obj, iteratee, context) {
963 var keys = _.keys(obj),
975 _.pairs = function(obj) {
976 var keys = _.keys(obj);
986 _.invert = function(obj) {
988 var keys = _.keys(obj);
997 _.functions = _.methods = function(obj) {
1000 if (_.isFunction(obj[key])) names.push(key);
1006 _.extend = createAssigner(_.allKeys);
1010 _.extendOwn = _.assign = createAssigner(_.keys);
1013 _.findKey = function(obj, predicate, context) {
1015 var keys = _.keys(obj), key;
1023 _.pick = function(object, oiteratee, context) {
1026 if (_.isFunction(oiteratee)) {
1027 keys = _.allKeys(obj);
1043 _.omit = function(obj, iteratee, context) {
1044 if (_.isFunction(iteratee)) {
1045 iteratee = _.negate(iteratee);
1047 var keys = _.map(flatten(arguments, false, false, 1), String);
1049 return !_.contains(keys, key);
1052 return _.pick(obj, iteratee, context);
1056 _.defaults = createAssigner(_.allKeys, true);
1061 _.create = function(prototype, props) {
1063 if (props) _.extendOwn(result, props);
1068 _.clone = function(obj) {
1069 if (!_.isObject(obj)) return obj;
1070 return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
1076 _.tap = function(obj, interceptor) {
1082 _.isMatch = function(object, attrs) {
1083 var keys = _.keys(attrs), length = keys.length;
1102 if (a instanceof _) a = a._wrapped;
1103 if (b instanceof _) b = b._wrapped;
1136 if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
1137 _.isFunction(bCtor) && bCtor instanceof bCtor)
1171 var keys = _.keys(a), key;
1174 if (_.keys(b).length !== length) return false;
1178 if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
1188 _.isEqual = function(a, b) {
1194 _.isEmpty = function(obj) {
1196 …if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.leng…
1197 return _.keys(obj).length === 0;
1201 _.isElement = function(obj) {
1207 _.isArray = nativeIsArray || function(obj) {
1212 _.isObject = function(obj) {
1218 _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) {
1219 _['is' + name] = function(obj) { function
1226 if (!_.isArguments(arguments)) {
1227 _.isArguments = function(obj) {
1228 return _.has(obj, 'callee');
1235 _.isFunction = function(obj) {
1241 _.isFinite = function(obj) {
1246 _.isNaN = function(obj) {
1247 return _.isNumber(obj) && obj !== +obj;
1251 _.isBoolean = function(obj) {
1256 _.isNull = function(obj) {
1261 _.isUndefined = function(obj) {
1267 _.has = function(obj, key) {
1276 _.noConflict = function() {
1277 root._ = previousUnderscore;
1282 _.identity = function(value) {
1287 _.constant = function(value) {
1293 _.noop = function(){};
1295 _.property = property;
1298 _.propertyOf = function(obj) {
1306 _.matcher = _.matches = function(attrs) {
1307 attrs = _.extendOwn({}, attrs);
1309 return _.isMatch(obj, attrs);
1314 _.times = function(n, iteratee, context) {
1322 _.random = function(min, max) {
1331 _.now = Date.now || function() {
1344 var unescapeMap = _.invert(escapeMap);
1352 var source = '(?:' + _.keys(map).join('|') + ')';
1360 _.escape = createEscaper(escapeMap);
1361 _.unescape = createEscaper(unescapeMap);
1365 _.result = function(object, property, fallback) {
1370 return _.isFunction(value) ? value.call(object) : value;
1376 _.uniqueId = function(prefix) {
1383 _.templateSettings = {
1415 _.template = function(text, settings, oldSettings) {
1417 settings = _.defaults({}, settings, _.templateSettings);
1461 return render.call(this, data, _);
1472 _.chain = function(obj) {
1473 var instance = _(obj);
1486 return instance._chain ? _(obj).chain() : obj;
1490 _.mixin = function(obj) {
1491 _.each(_.functions(obj), function(name) {
1492 var func = _[name] = obj[name];
1493 _.prototype[name] = function() { function
1496 return result(this, func.apply(_, args));
1502 _.mixin(_);
1505 _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
1507 _.prototype[name] = function() {
1516 _.each(['concat', 'join', 'slice'], function(name) {
1518 _.prototype[name] = function() {
1524 _.prototype.value = function() {
1530 _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
1532 _.prototype.toString = function() {
1545 return _;