mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
feat: is.not
This commit is contained in:
parent
5c65f9e7f5
commit
c558eaf35c
1 changed files with 8 additions and 0 deletions
|
|
@ -2,6 +2,14 @@ export const is = {
|
|||
boolean: (d: unknown): d is boolean => typeof d === 'boolean',
|
||||
number: (d: unknown): d is number => typeof d === 'number',
|
||||
string: (d: unknown): d is string => typeof d === 'string',
|
||||
not: {
|
||||
undefined: <T>(d: T | undefined): d is T => d !== undefined,
|
||||
null: <T>(d: T | null): d is T => d !== null,
|
||||
true: <T>(d: T | true): d is T => d !== true,
|
||||
false: <T>(d: T | false): d is T => d !== false,
|
||||
number: <T>(d: T | number): d is T => typeof d !== 'number',
|
||||
string: <T>(d: T | string): d is T => typeof d !== 'string',
|
||||
},
|
||||
JSON: {
|
||||
object(d: unknown): d is JSONObject {
|
||||
return (typeof d === 'object' && d && !Array.isArray(d)) || false
|
||||
|
|
|
|||
Loading…
Reference in a new issue