diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-07-19 15:37:24 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-07-19 15:37:24 -0500 |
commit | dc55f580049d284c6e01271e3885c4fa23a8f458 (patch) | |
tree | 64112d4525410ef3ca8553901af81f5df1e216da /src/state/lib/type-guards.ts | |
parent | 6b32698b3e020e5910c92b72a1677e7cd56287d6 (diff) | |
download | voidsky-dc55f580049d284c6e01271e3885c4fa23a8f458.tar.zst |
Replace mobx-state-tree with mobx and get a basic home feed rendering
Diffstat (limited to 'src/state/lib/type-guards.ts')
-rw-r--r-- | src/state/lib/type-guards.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/state/lib/type-guards.ts b/src/state/lib/type-guards.ts new file mode 100644 index 000000000..4ae31f3ac --- /dev/null +++ b/src/state/lib/type-guards.ts @@ -0,0 +1,10 @@ +export function isObj(v: unknown): v is Record<string, unknown> { + return !!v && typeof v === 'object' +} + +export function hasProp<K extends PropertyKey>( + data: object, + prop: K, +): data is Record<K, unknown> { + return prop in data +} |