-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
14 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import {IRequest} from "../../interfaces"; | ||
|
||
export const JSONTransform = async <T extends object = object>(request: IRequest): Promise<T> => { | ||
request.headers.assert("Content-Type", ["application/json"]); | ||
request.headers.assert("content-type", ["application/json"]); | ||
const buffer = await request.getBuffer(); | ||
return JSON.parse(buffer.toString("utf-8")); | ||
}; |
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 |
---|---|---|
@@ -1 +1,6 @@ | ||
export const noop = () => void 0; | ||
export function curry<A extends any[], T, S>(fn: (arg1: T, ...args: A) => S, value: T) { | ||
return (...args: A) => { | ||
return fn(value, ...args); | ||
}; | ||
} |
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,3 @@ | ||
export function compare(str1: string, str2: string) { | ||
return str1.toLowerCase() === str2.toLowerCase(); | ||
} |