Skip to content

Commit

Permalink
fix/number-parsing (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolae-Rares Ailincai authored May 2, 2023
1 parent c2627d6 commit d7ce1cc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prisma-mapper",
"version": "1.4.1",
"version": "1.4.2",
"description": "A CLI that adds @Map, @@Map, @updatedAt based on a json or camel case for the prisma schema",
"main": "bin/index.js",
"preferGlobal": true,
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/expected.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ model ModelOne {
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
string String @default("String 1")
@@index([deletedAt, someId], map: "index_name")
@@map("model_one")
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/mock.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ model model_one {
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime? @db.Timestamptz(6)
deleted_at DateTime? @db.Timestamptz(6)
string String @default("String 1")
@@index([deleted_at, some_id], map: "index_name")
}
Expand Down
2 changes: 1 addition & 1 deletion src/functions/deserialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const handlers = (
.join(', ')}))`;
}

if (typeof value === 'number' || !Number.isNaN(value)) {
if (typeof value === 'number' || !Number.isNaN(+value)) {
return `@default(${value})`;
}

Expand Down

0 comments on commit d7ce1cc

Please sign in to comment.