-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explore Endpoints: data flow functional
- Loading branch information
Showing
11 changed files
with
404 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { AnyObject } from "@/types/types"; | ||
|
||
export const isEmptyObject = (obj: AnyObject) => { | ||
return Object.keys(obj).length === 0; | ||
}; |
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 { AnyObject } from "@/types/types"; | ||
|
||
export const sanitizeObject = <T extends AnyObject>(obj: T) => { | ||
return Object.keys(obj).reduce((res, param) => { | ||
const paramValue = obj[param]; | ||
|
||
if (paramValue) { | ||
return { ...res, [param]: paramValue }; | ||
} | ||
|
||
return res; | ||
}, {} as T); | ||
}; |
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,11 @@ | ||
import { useEffect, useRef } from "react"; | ||
|
||
export const usePrevious = <T>(value: T) => { | ||
const ref = useRef<T>(); | ||
|
||
useEffect(() => { | ||
ref.current = value; | ||
}, [value]); | ||
|
||
return ref.current; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { asset } from "./methods/asset"; | ||
import { assetCode } from "./methods/assetCode"; | ||
import { positiveInt } from "./methods/positiveInt"; | ||
import { publicKey } from "./methods/publicKey"; | ||
|
||
export const validate = { | ||
asset, | ||
assetCode, | ||
positiveInt, | ||
publicKey, | ||
}; |
Oops, something went wrong.