[lodash] _.rest, _.last, and _.first audit

This commit is contained in:
Spencer Alger 2015-06-12 11:32:02 -07:00
parent a5e60999b0
commit ebb705cd89
4 changed files with 8 additions and 15 deletions

View file

@ -36,10 +36,7 @@ define(function (require) {
source.activeFetchCount = 1;
}
if (source.history) {
source.history.push(this);
source.history = _.last(source.history, 1);
}
source.history = [this];
};
AbstractReq.prototype.getFetchParams = function () {

View file

@ -67,10 +67,8 @@ define(function (require) {
* @param {*} [arg...] - any number of arguments that will be applied to each handler
* @return {SimpleEmitter} - this, for chaining
*/
SimpleEmitter.prototype.emit = function (name, arg) {
SimpleEmitter.prototype.emit = _.restParam(function (name, args) {
if (!this._listeners[name]) return this;
var args = _.rest(arguments);
var listeners = this.listeners(name);
var i = -1;
@ -79,7 +77,7 @@ define(function (require) {
}
return this;
};
});
/**
* Get a list of the event names that currently have listeners

View file

@ -157,7 +157,7 @@ define(function (require) {
});
function check(xPercent, yPercent/*, prev, directions... */) {
var directions = _.rest(arguments, 2);
var directions = _.drop(arguments, 2);
var event = makeEvent(xPercent, yPercent);
var placement = posTT({
$window: $window,
@ -226,4 +226,4 @@ define(function (require) {
});
});
};
});
});

View file

@ -39,9 +39,7 @@ define(function (require) {
});
// helper
sinon.decorateWithSpy = function (/* prop... */) {
var props = _.rest(arguments, 0);
sinon.decorateWithSpy = _.restParam(function (props) {
return function ($delegate) {
props.forEach(function (prop) {
sinon.spy($delegate, prop);
@ -49,7 +47,7 @@ define(function (require) {
return $delegate;
};
};
});
afterEach(function () {
if (!toRestore.length) return;
@ -62,4 +60,4 @@ define(function (require) {
});
return sinon;
});
});