Skip to content

Commit b806875

Browse files
author
Acidiney Dias
committed
chore: publish version 2.0.1
1 parent 16a49ce commit b806875

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-dto",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "A small dto lib for nodejs",
55
"exports": {
66
"require": "./dist/index.js",

src/node_dto.mjs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -196,31 +196,35 @@ export class NodeDto {
196196

197197
const result = input.map((row) => this.#validate(row));
198198
const withErrors = [];
199-
const withSuccess = []
200-
199+
const withSuccess = [];
201200

202201
for (const row of result) {
203202
const keys = Object.keys(row);
204-
withErrors.push({})
205-
withSuccess.push({})
203+
withErrors.push({});
204+
withSuccess.push({});
206205
for (const key of keys) {
207206
if (!row[key].success) {
208-
withErrors[withErrors.length - 1] = { ...withErrors[withErrors.length - 1], [key]: row[key].value[0] };
209-
continue
207+
withErrors[withErrors.length - 1] = {
208+
...withErrors[withErrors.length - 1],
209+
[key]: row[key].value[0],
210+
};
211+
continue;
210212
}
211-
withSuccess[withSuccess.length - 1] = { ...withSuccess[withSuccess.length - 1], [key]: row[key].value };
213+
withSuccess[withSuccess.length - 1] = {
214+
...withSuccess[withSuccess.length - 1],
215+
[key]: row[key].value,
216+
};
212217
}
213218
}
214219

215-
216-
if (withErrors.filter(f => Object.keys(f).length).length) {
220+
if (withErrors.filter((f) => Object.keys(f).length).length) {
217221
return { success: false, errors: withErrors };
218222
}
219223

220224
return {
221225
success: true,
222-
value: isArray ? withSuccess : withSuccess[0]
223-
}
226+
value: isArray ? withSuccess : withSuccess[0],
227+
};
224228
}
225229

226230
entries() {
@@ -265,9 +269,10 @@ export class NodeDto {
265269

266270
for (const dt of this.#schema) {
267271
sql.push(
268-
`${entity
269-
? `${entity}.${dt.serialize} as ${dt.name}`
270-
: `${dt.serialize} as ${dt.name}`
272+
`${
273+
entity
274+
? `${entity}.${dt.serialize} as ${dt.name}`
275+
: `${dt.serialize} as ${dt.name}`
271276
}`,
272277
);
273278
}

0 commit comments

Comments
 (0)