feat: add sync.isNone, fix sync payload type (#11)

* feat: add `sync.isNone`, fix sync payload type

* docs: add `isNone`
This commit is contained in:
richard 2024-07-07 01:09:57 -07:00 • committed by GitHub
parent d73963e1c5
commit 333a86b43f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 84 additions and 16 deletions

View file

@ -1,4 +1,5 @@
local client = require(script.client)
local patch = require(script.patch)
local server = require(script.server)
--[=[
@ -8,4 +9,5 @@ local server = require(script.server)
return {
client = client,
server = server,
isNone = patch.isNone,
}

View file

@ -6,6 +6,10 @@ local validate = require(script.Parent.validate)
]=]
local NONE = { __none = "__none" }
local function isNone(value: any): boolean
return type(value) == "table" and value.__none == "__none"
end
local function diff(prevState: { [any]: any }, nextState: { [any]: any })
local patches = table.clone(nextState)
@ -62,6 +66,7 @@ end
return {
NONE = NONE,
isNone = isNone,
diff = diff,
apply = apply,
}