mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-09 00:09:55 +00:00
Scene save operations (in-place overwrite vs copy) (#126)
This commit is contained in:
@@ -35,4 +35,9 @@ describe("deref", () => {
|
||||
const v3 = deref((() => {})());
|
||||
expect(v3).toBe(undefined);
|
||||
});
|
||||
|
||||
it("should return `undefined` when given an empty Ref", () => {
|
||||
const derefed = deref(createRef());
|
||||
expect(derefed).toBe(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,6 +11,9 @@ function isRef<T>(refOrValue: Ref<T> | T): refOrValue is Ref<T> {
|
||||
if (!refOrValue || typeof refOrValue !== "object")
|
||||
return false;
|
||||
|
||||
if (refOrValue instanceof Element)
|
||||
return false;
|
||||
|
||||
const keys = Object.keys(refOrValue);
|
||||
return keys.length === 1 && keys[0] === "value"
|
||||
return keys.length === 0 || (keys.length === 1 && keys[0] === "value")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user