mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[lodash] _.rest, _.last, and _.first audit
This commit is contained in:
parent
a5e60999b0
commit
ebb705cd89
4 changed files with 8 additions and 15 deletions
|
@ -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 () {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
|||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue