-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to incorporate review feedback. Always require types.
- Loading branch information
Showing
23 changed files
with
712 additions
and
487 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* Determines if a provided object has a given property name. | ||
*/ | ||
export function hasOwnProperty(obj: unknown, prop: string): boolean; |
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,6 @@ | ||
/** | ||
* Determines if a provided object has a given property name. | ||
*/ | ||
export function hasOwnProperty(obj: mixed, prop: string): boolean { | ||
return Object.prototype.hasOwnProperty.call(obj, prop); | ||
} |
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,8 @@ | ||
/** | ||
* As per the GraphQL Spec, Integers are only treated as valid when a valid | ||
* 32-bit signed integer, providing the broadest support across platforms. | ||
* | ||
* n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because | ||
* they are internally represented as IEEE 754 doubles. | ||
*/ | ||
export function isSignedInt32(value: unknown): value is number; |
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,18 @@ | ||
const MAX_INT32 = 2147483647; | ||
const MIN_INT32 = -2147483648; | ||
|
||
/** | ||
* As per the GraphQL Spec, Integers are only treated as valid when a valid | ||
* 32-bit signed integer, providing the broadest support across platforms. | ||
* | ||
* n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because | ||
* they are internally represented as IEEE 754 doubles. | ||
*/ | ||
export function isSignedInt32(value: mixed): boolean %checks { | ||
return ( | ||
typeof value === 'number' && | ||
Number.isInteger(value) && | ||
value <= MAX_INT32 && | ||
value >= MIN_INT32 | ||
); | ||
} |
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
Oops, something went wrong.