-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert Timestamp values from BigNumber to number (#34)
- Loading branch information
Showing
6 changed files
with
33 additions
and
16 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/website/public/services/candidConverters/localMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { LocalMessage } from "../../model/messages"; | ||
import { fromCandid as timestampFromCandid } from "./timestamp"; | ||
import { fromCandid as userIdFromCandid } from "./userId"; | ||
|
||
export function fromCandid(value: any) : LocalMessage { | ||
return { | ||
kind: "local", | ||
id: value.id, | ||
timestamp: timestampFromCandid(value.timestamp), | ||
sender: userIdFromCandid(value.sender), | ||
text: value.text | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import BigNumber from "bignumber.js"; | ||
|
||
import { Timestamp } from "../../model/common"; | ||
|
||
export function fromCandid(value: BigNumber) : Timestamp { | ||
return Number(value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters