Skip to content

Commit

Permalink
Fixing a regression of limit() by switching to [].slice()
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Oct 27, 2016
1 parent 37eaac5 commit 2c76e4b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
11 changes: 6 additions & 5 deletions lib/haro.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @copyright 2016
* @license BSD-3-Clause
* @link https://github.com/avoidwork/haro
* @version 3.0.2
* @version 3.0.3
*/
"use strict";

Expand Down Expand Up @@ -668,9 +668,10 @@ class Haro {
}

limit (offset = 0, max = 0, raw = false) {
let result = this.registry.slice(offset, max).map(i => {
return this.get(i, raw);
});
const end = offset + max,
result = this.registry.slice(offset, end).map(i => {
return this.get(i, raw);
});

return !raw ? tuple.apply(tuple, result) : result;
}
Expand Down Expand Up @@ -1251,7 +1252,7 @@ function factory (data = null, config = {}, indexes = []) {
}

factory.transform = cast;
factory.version = "3.0.2";
factory.version = "3.0.3";

// Node, AMD & window supported
if (typeof exports !== "undefined") {
Expand Down
7 changes: 4 additions & 3 deletions lib/haro.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @copyright 2016
* @license BSD-3-Clause
* @link https://github.com/avoidwork/haro
* @version 3.0.2
* @version 3.0.3
*/
"use strict";

Expand Down Expand Up @@ -738,7 +738,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var raw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

var result = this.registry.slice(offset, max).map(function (i) {
var end = offset + max,
result = this.registry.slice(offset, end).map(function (i) {
return _this5.get(i, raw);
});

Expand Down Expand Up @@ -1412,7 +1413,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}

factory.transform = cast;
factory.version = "3.0.2";
factory.version = "3.0.3";

// Node, AMD & window supported
if (typeof exports !== "undefined") {
Expand Down
Loading

0 comments on commit 2c76e4b

Please sign in to comment.