Socket
Socket
Sign inDemoInstall

underscore

Package Overview
Dependencies
0
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.4 to 1.5.0

underscore-min.map

7

package.json

@@ -9,9 +9,10 @@ {

"main" : "underscore.js",
"version" : "1.4.4",
"version" : "1.5.0",
"devDependencies": {
"phantomjs": "0.2.2"
"phantomjs": "1.9.0-1"
},
"scripts": {
"test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true"
}
},
"license" : "MIT"
}

@@ -1,4 +0,5 @@

// Underscore.js 1.4.4
// Underscore.js 1.5.0
// http://underscorejs.org
// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
// (c) 2009-2011 Jeremy Ashkenas, DocumentCloud Inc.
// (c) 2011-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.

@@ -24,7 +25,8 @@

// Create quick reference variables for speed access to core prototypes.
var push = ArrayProto.push,
slice = ArrayProto.slice,
concat = ArrayProto.concat,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
var
push = ArrayProto.push,
slice = ArrayProto.slice,
concat = ArrayProto.concat,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;

@@ -68,3 +70,3 @@ // All **ECMAScript 5** native function implementations that we hope to use

// Current version.
_.VERSION = '1.4.4';
_.VERSION = '1.5.0';

@@ -101,3 +103,3 @@ // Collection Functions

each(obj, function(value, index, list) {
results[results.length] = iterator.call(context, value, index, list);
results.push(iterator.call(context, value, index, list));
});

@@ -177,3 +179,3 @@ return results;

each(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) results[results.length] = value;
if (iterator.call(context, value, index, list)) results.push(value);
});

@@ -245,3 +247,3 @@ return results;

_.where = function(obj, attrs, first) {
if (_.isEmpty(attrs)) return first ? null : [];
if (_.isEmpty(attrs)) return first ? void 0 : [];
return _[first ? 'find' : 'filter'](obj, function(value) {

@@ -263,3 +265,3 @@ for (var key in attrs) {

// Can't optimize arrays of integers longer than 65,535 elements.
// See: https://bugs.webkit.org/show_bug.cgi?id=80797
// See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797)
_.max = function(obj, iterator, context) {

@@ -273,3 +275,3 @@ if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {

var computed = iterator ? iterator.call(context, value, index, list) : value;
computed >= result.computed && (result = {value : value, computed : computed});
computed > result.computed && (result = {value : value, computed : computed});
});

@@ -334,3 +336,3 @@ return result.value;

var result = {};
var iterator = lookupIterator(value || _.identity);
var iterator = lookupIterator(value == null ? _.identity : value);
each(obj, function(value, index) {

@@ -374,3 +376,3 @@ var key = iterator.call(context, value, index, obj);

// Safely convert anything iterable into a real, live array.
// Safely create a real, live array from anything iterable.
_.toArray = function(obj) {

@@ -434,4 +436,7 @@ if (!obj) return [];

var flatten = function(input, shallow, output) {
if (shallow && _.every(input, _.isArray)) {
return concat.apply(output, input);
}
each(input, function(value) {
if (_.isArray(value)) {
if (_.isArray(value) || _.isArguments(value)) {
shallow ? push.apply(output, value) : flatten(value, shallow, output);

@@ -479,3 +484,3 @@ } else {

_.union = function() {
return _.uniq(concat.apply(ArrayProto, arguments));
return _.uniq(_.flatten(arguments, true));
};

@@ -504,7 +509,16 @@

_.zip = function() {
var args = slice.call(arguments);
var length = _.max(_.pluck(args, 'length'));
return _.unzip.apply(_, slice.call(arguments));
};
// The inverse operation to `_.zip`. If given an array of pairs it
// returns an array of the paired elements split into two left and
// right element arrays, if given an array of triples it returns a
// three element array and so on. For example, `_.unzip` given
// `[['a',1],['b',2],['c',3]]` returns the array
// [['a','b','c'],[1,2,3]].
_.unzip = function() {
var length = _.max(_.pluck(arguments, "length").concat(0));
var results = new Array(length);
for (var i = 0; i < length; i++) {
results[i] = _.pluck(args, "" + i);
results[i] = _.pluck(arguments, '' + i);
}

@@ -589,2 +603,5 @@ return results;

// Reusable constructor function for prototype setting.
var ctor = function(){};
// Create a function bound to a given object (assigning `this`, and arguments,

@@ -594,6 +611,14 @@ // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if

_.bind = function(func, context) {
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
var args = slice.call(arguments, 2);
return function() {
return func.apply(context, args.concat(slice.call(arguments)));
var args, bound;
if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError;
args = slice.call(arguments, 2);
return bound = function() {
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
ctor.prototype = func.prototype;
var self = new ctor;
ctor.prototype = null;
var result = func.apply(self, args.concat(slice.call(arguments)));
if (Object(result) === result) return result;
return self;
};

@@ -615,3 +640,3 @@ };

var funcs = slice.call(arguments, 1);
if (funcs.length === 0) funcs = _.functions(obj);
if (funcs.length === 0) throw new Error("bindAll must be passed function names");
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });

@@ -645,6 +670,11 @@ return obj;

// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time.
_.throttle = function(func, wait) {
var context, args, timeout, result;
// during a given window of time. Normally, the throttled function will run
// as much as it can, without ever going more than once per `wait` duration;
// but if you'd like to disable the execution on the leading edge, pass
// `{leading: false}`. To disable execution on the trailing edge, ditto.
_.throttle = function(func, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
options || (options = {});
var later = function() {

@@ -657,2 +687,3 @@ previous = new Date;

var now = new Date;
if (!previous && options.leading === false) previous = now;
var remaining = wait - (now - previous);

@@ -666,3 +697,3 @@ context = this;

result = func.apply(context, args);
} else if (!timeout) {
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining);

@@ -679,3 +710,4 @@ }

_.debounce = function(func, wait, immediate) {
var timeout, result;
var result;
var timeout = null;
return function() {

@@ -734,3 +766,2 @@ var context = this, args = arguments;

_.after = function(times, func) {
if (times <= 0) return func();
return function() {

@@ -751,3 +782,3 @@ if (--times < 1) {

var keys = [];
for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
for (var key in obj) if (_.has(obj, key)) keys.push(key);
return keys;

@@ -824,3 +855,3 @@ };

for (var prop in source) {
if (obj[prop] == null) obj[prop] = source[prop];
if (obj[prop] === void 0) obj[prop] = source[prop];
}

@@ -849,3 +880,3 @@ }

// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a == 1 / b;

@@ -892,2 +923,9 @@ // A strict comparison is necessary because `null == undefined`.

}
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
_.isFunction(bCtor) && (bCtor instanceof bCtor))) {
return false;
}
// Add the first object to the stack of traversed objects.

@@ -909,9 +947,2 @@ aStack.push(a);

} else {
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
_.isFunction(bCtor) && (bCtor instanceof bCtor))) {
return false;
}
// Deep compare objects.

@@ -1040,3 +1071,3 @@ for (var key in a) {

_.times = function(n, iterator, context) {
var accum = Array(n);
var accum = Array(Math.max(0, n));
for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);

@@ -1084,6 +1115,6 @@ return accum;

// If the value of the named property is a function then invoke it;
// otherwise, return it.
// If the value of the named `property` is a function then invoke it with the
// `object` as context; otherwise, return it.
_.result = function(object, property) {
if (object == null) return null;
if (object == null) return void 0;
var value = object[property];

@@ -1090,0 +1121,0 @@ return _.isFunction(value) ? value.call(object) : value;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc