Skip to content

Commit

Permalink
chore: getting rid of JSON.parse in offsetData
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed Feb 16, 2021
1 parent 514178e commit 95a9fb8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,9 @@ export function validateOffset(interval: string, prefix: string): number {

export function offsetData(data: EntityCachePoints, offset: number | undefined): EntityCachePoints {
if (offset) {
const lData = JSON.parse(JSON.stringify(data));
lData.forEach((entry) => {
entry[0] = entry[0] - offset;
return data.map((entry) => {
return [entry[0] - offset, entry[1]];
});
return lData;
}
return data;
}
Expand Down

0 comments on commit 95a9fb8

Please sign in to comment.