about summary refs log tree commit diff
path: root/src/state/lib/type-guards.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-07-19 15:37:24 -0500
committerPaul Frazee <pfrazee@gmail.com>2022-07-19 15:37:24 -0500
commitdc55f580049d284c6e01271e3885c4fa23a8f458 (patch)
tree64112d4525410ef3ca8553901af81f5df1e216da /src/state/lib/type-guards.ts
parent6b32698b3e020e5910c92b72a1677e7cd56287d6 (diff)
downloadvoidsky-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.ts10
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
+}