mirror of
https://github.com/littensy/charm.git
synced 2026-10-23 05:46:27 +00:00
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:
parent
d73963e1c5
commit
333a86b43f
4 changed files with 84 additions and 16 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue