-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PBjs Utils: Faster Deep Clone #11418
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ module.exports = { | |
], | ||
'src': [ | ||
'fun-hooks/no-eval', | ||
'just-clone', | ||
'klona', | ||
'dlv', | ||
'dset' | ||
], | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {config} from './config.js'; | ||
import clone from 'just-clone'; | ||
import {klona} from 'klona/json'; | ||
import {includes} from './polyfill.js'; | ||
import { EVENTS, S2S } from './constants.js'; | ||
import {GreedyPromise} from './utils/promise.js'; | ||
|
@@ -609,7 +609,7 @@ export function shuffle(array) { | |
} | ||
|
||
export function deepClone(obj) { | ||
return clone(obj); | ||
return klona(obj) || {}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Version 1 of just-clone gives back an empty object when the cloning fails. The newer versions don't do that, just like klona. This is here to preserve that behavior. |
||
} | ||
|
||
export function inIframe() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version 1 of just-clone casts everything to an object, even though in this case it was a string (I am not sure if this was wanted behavior, but it resulted in a failed test).
The newer versions don't do that, just like klona.
This is here to preserve that behavior.