Skip to content

Commit

Permalink
🚀 Releasing 0.2.0 🎉 - Little fix 🛠
Browse files Browse the repository at this point in the history
Just fixed ES6
  • Loading branch information
arguiot committed Jul 3, 2017
1 parent 7d06363 commit 74dd7fe
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 28 deletions.
22 changes: 10 additions & 12 deletions dist/display.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,32 +474,30 @@ class DisplayJS {
}
// Math and array manipulation
arange(start, end, step, offset) {
var len = (Math.abs(end - start) + ((offset || 0) * 2)) / (step || 1) + 1;
var direction = start < end ? 1 : -1;
var startingPoint = start - (direction * (offset || 0));
var stepSize = direction * (step || 1);
const len = (Math.abs(end - start) + ((offset || 0) * 2)) / (step || 1) + 1;
const direction = start < end ? 1 : -1;
const startingPoint = start - (direction * (offset || 0));
const stepSize = direction * (step || 1);

return Array(len).fill(0).map(function(_, index) {
return startingPoint + (stepSize * index);
});
return Array(len).fill(0).map((_, index) => startingPoint + (stepSize * index));

}
range(n) {
return this.arange(0,n,1)
}
linespace(start, end, n) {
var diff = end - start;
var step = diff / n;
const diff = end - start;
const step = diff / n;
return this.arange(start, end, step);
}
forIn(range, callback) {
for (var i = range.length - 1; i >= 0; i--) {
for (let i = range.length - 1; i >= 0; i--) {
callback(range[i]);
}
}
reshape(array, part) {
var tmp = [];
for(var i = 0; i < array.length; i += part) {
const tmp = [];
for(let i = 0; i < array.length; i += part) {
tmp.push(array.slice(i, i + part));
}
return tmp;
Expand Down
8 changes: 4 additions & 4 deletions dist/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,16 +592,16 @@ var DisplayJS = function () {
}, {
key: "forIn",
value: function forIn(range, callback) {
for (var i = range.length - 1; i >= 0; i--) {
callback(range[i]);
for (var _i8 = range.length - 1; _i8 >= 0; _i8--) {
callback(range[_i8]);
}
}
}, {
key: "reshape",
value: function reshape(array, part) {
var tmp = [];
for (var i = 0; i < array.length; i += part) {
tmp.push(array.slice(i, i + part));
for (var _i9 = 0; _i9 < array.length; _i9 += part) {
tmp.push(array.slice(_i9, _i9 + part));
}
return tmp;
}
Expand Down
22 changes: 10 additions & 12 deletions src/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,32 +474,30 @@ class DisplayJS {
}
// Math and array manipulation
arange(start, end, step, offset) {
var len = (Math.abs(end - start) + ((offset || 0) * 2)) / (step || 1) + 1;
var direction = start < end ? 1 : -1;
var startingPoint = start - (direction * (offset || 0));
var stepSize = direction * (step || 1);
const len = (Math.abs(end - start) + ((offset || 0) * 2)) / (step || 1) + 1;
const direction = start < end ? 1 : -1;
const startingPoint = start - (direction * (offset || 0));
const stepSize = direction * (step || 1);

return Array(len).fill(0).map(function(_, index) {
return startingPoint + (stepSize * index);
});
return Array(len).fill(0).map((_, index) => startingPoint + (stepSize * index));

}
range(n) {
return this.arange(0,n,1)
}
linespace(start, end, n) {
var diff = end - start;
var step = diff / n;
const diff = end - start;
const step = diff / n;
return this.arange(start, end, step);
}
forIn(range, callback) {
for (var i = range.length - 1; i >= 0; i--) {
for (let i = range.length - 1; i >= 0; i--) {
callback(range[i]);
}
}
reshape(array, part) {
var tmp = [];
for(var i = 0; i < array.length; i += part) {
const tmp = [];
for(let i = 0; i < array.length; i += part) {
tmp.push(array.slice(i, i + part));
}
return tmp;
Expand Down

0 comments on commit 74dd7fe

Please sign in to comment.