-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
10 changed files
with
242 additions
and
100 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
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,36 @@ | ||
import Mix from '@ember/polyfills/types'; | ||
|
||
export type Nullable<T> = T | null | undefined; | ||
|
||
export interface PlainObject { | ||
[key: string]: string | PlainObject | PlainObject[]; | ||
} | ||
|
||
export interface PlainHeaders { | ||
[key: string]: string | undefined | null; | ||
} | ||
|
||
export type Method = | ||
| 'HEAD' | ||
| 'GET' | ||
| 'POST' | ||
| 'PUT' | ||
| 'PATCH' | ||
| 'DELETE' | ||
| 'OPTIONS'; | ||
|
||
export type AjaxOptions = { | ||
url: string; | ||
type: Method; | ||
data?: PlainObject | BodyInit; | ||
headers?: PlainHeaders; | ||
}; | ||
|
||
export type FetchOptions = Mix< | ||
AjaxOptions, | ||
{ body?: BodyInit | null; method?: Method } | ||
>; | ||
|
||
export function isPlainObject(obj: any): obj is PlainObject { | ||
return Object.prototype.toString.call(obj) === '[object Object]'; | ||
} |
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
Oops, something went wrong.