Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars-Erik Roald committed Jun 22, 2024
1 parent f3b3adf commit 9f14fe9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
36 changes: 18 additions & 18 deletions src/client/cloneFromDb.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
let dateToISOString = require('../dateToISOString');

function cloneFromDb(obj) {
if (obj === null || typeof obj !== 'object')
return obj;
if (Array.isArray(obj)) {
const arrClone = [];
for (let i = 0; i < obj.length; i++) {
arrClone[i] = cloneFromDb(obj[i]);
}
return arrClone;
}
else if (obj instanceof Date && !isNaN(obj))
return dateToISOString(obj);
const clone = {};
const keys = Object.keys(obj);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
clone[key] = cloneFromDb(obj[key]);
}
return clone;
if (obj === null || typeof obj !== 'object')
return obj;
if (Array.isArray(obj)) {
const arrClone = [];
for (let i = 0; i < obj.length; i++) {
arrClone[i] = cloneFromDb(obj[i]);
}
return arrClone;
}
else if (obj instanceof Date && !isNaN(obj))
return dateToISOString(obj);
const clone = {};
const keys = Object.keys(obj);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
clone[key] = cloneFromDb(obj[key]);
}
return clone;
}


Expand Down
2 changes: 1 addition & 1 deletion src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ function rdbClient(options = {}) {

};
let innerProxy = new Proxy(array, handler);
//todo
//todo
rootMap.set(array, { json: cloneFromDb(array), strategy, originalArray: [...array] });
if (strategy !== undefined) {
const { limit, ...cleanStrategy } = { ...strategy };
Expand Down
4 changes: 2 additions & 2 deletions src/getManyDto.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ async function decode(strategy, span, rows, keys = rows.length > 0 ? Object.keys
const column = columns[j];
outRow[column.alias] = column.decode(row[keys[j]]);
}

for (let j = 0; j < aggregateKeys.length; j++) {
const key = aggregateKeys[j];
const parse = span.aggregates[key].column?.decode || Number.parseFloat;
outRow[key] = parse(row[keys[j+columnsLength]]);
}

outRows[i] = outRow;
if (shouldCreateMap) {
fkIds[i] = getIds(outRow);
Expand Down

0 comments on commit 9f14fe9

Please sign in to comment.