Skip to content

Commit

Permalink
Fix: Node 14 does not support Array.prototype.at
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenhutchings committed Apr 28, 2023
1 parent 0df8fbd commit 2ed13ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib/utils/interpolate.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export default (values) => {

return values.reduce((stack, next, i) => {
if (isFinite(next) || i === values.length - 1) {
next = next ?? stack.at(-1)
next = next ?? stack.slice(-1)[0]

if (count > 0) {
const prev = stack.at(-1) ?? next
const prev = stack.slice(-1)[0] ?? next
const delta = 1 / (count + 1)
const index = stack.length

Expand Down
2 changes: 1 addition & 1 deletion src/templates/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export default ({
if (area) {
// For lines with fewer points, continue along the baseline
data.forEach((line, i) => {
const curve = line.at(-1)?.curve
const curve = line.slice(-1)[0]?.curve
while (line.length < maxLength) {
line.push({ x: map.x({}, i, line.length), y: 0, ignore: true, curve })
}
Expand Down

0 comments on commit 2ed13ce

Please sign in to comment.