mirror of
https://github.com/littensy/charm.git
synced 2026-10-21 03:36:11 +00:00
feat: add toRaw()
This commit is contained in:
parent
f082956ed9
commit
9f66803f04
13 changed files with 297 additions and 198 deletions
|
|
@ -39,7 +39,7 @@ end
|
|||
long as the target array is not sparse. This function ensures that the diff
|
||||
function produces a patch that can be correctly applied.
|
||||
]]
|
||||
local function stringifySparseArray(object: { any }): { [string | number]: any }
|
||||
local function stringifySparseArray(object: {}): { [string | number]: any }
|
||||
local maxn = table.maxn(object)
|
||||
|
||||
if maxn == 0 or maxn == #object then
|
||||
|
|
@ -65,7 +65,7 @@ local function diff(oldState: any, newState: any): any
|
|||
return newState
|
||||
end
|
||||
|
||||
local diffs: { [any]: any } = table.clone(newState)
|
||||
local diffs = table.clone(newState)
|
||||
|
||||
for key, oldValue in oldState do
|
||||
diffs[key] = diff(oldValue, newState[key])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue