Skip to content

Commit 06e24f6

Browse files
committed
Fixed the formatting
1 parent be0137b commit 06e24f6

File tree

3 files changed

+8
-22
lines changed

3 files changed

+8
-22
lines changed

src/formats/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export function inferObjectFormat(value: object): JSONObjectFormat | undefined {
120120
return undefined;
121121
}
122122

123-
export type JSONIntFormat = JSONTimestampFormat
123+
export type JSONIntFormat = JSONTimestampFormat;
124124

125125
const intFormats = [inferTimestamp];
126126

@@ -134,4 +134,4 @@ export function inferIntFormat(value: number): JSONIntFormat | undefined {
134134
}
135135

136136
return undefined;
137-
}
137+
}

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export function inferType(value: unknown): JSONValueType {
4545

4646
if (typeof value === "number") {
4747
if (Number.isInteger(value)) {
48-
return {
49-
name: "int",
48+
return {
49+
name: "int",
5050
value,
5151
format: inferIntFormat(value),
5252
};

tests/intFormats.test.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,24 @@
11
import { inferType } from "../src";
22

33
describe("timestamps", () => {
4-
test.each([1664976736123, 1664976736567])(
5-
"%p should be inferred as an timestamp",
6-
(value) => {
7-
expect(inferType(value)).toEqual({
8-
name: "int",
9-
value,
10-
format: {
11-
name: "timestamp",
12-
variant: "millisecondsSinceEpoch",
13-
},
14-
});
15-
},
16-
);
17-
18-
test.each([1664976736, 1664976736])("%p should be inferred as an timestamp", (value) => {
4+
test.each([1664976736123, 1664976736567])("%p should be inferred as an timestamp", (value) => {
195
expect(inferType(value)).toEqual({
206
name: "int",
217
value,
228
format: {
239
name: "timestamp",
24-
variant: "secondsSinceEpoch",
10+
variant: "millisecondsSinceEpoch",
2511
},
2612
});
2713
});
2814

29-
test.each([1664976736946364285])("%p should be inferred as an timestamp", (value) => {
15+
test.each([1664976736, 1664976736])("%p should be inferred as an timestamp", (value) => {
3016
expect(inferType(value)).toEqual({
3117
name: "int",
3218
value,
3319
format: {
3420
name: "timestamp",
35-
variant: "nanosecondsSinceEpoch",
21+
variant: "secondsSinceEpoch",
3622
},
3723
});
3824
});

0 commit comments

Comments
 (0)