summaryrefslogtreecommitdiff
path: root/js/util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/util.ts')
-rw-r--r--js/util.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/js/util.ts b/js/util.ts
index 9ba1d6346..c5197164e 100644
--- a/js/util.ts
+++ b/js/util.ts
@@ -131,3 +131,9 @@ const TypedArrayConstructor = Object.getPrototypeOf(Uint8Array);
export function isTypedArray(x: unknown): x is TypedArray {
return x instanceof TypedArrayConstructor;
}
+
+// Returns whether o is an object, not null, and not a function.
+// @internal
+export function isObject(o: unknown): o is object {
+ return o != null && typeof o === "object";
+}