Skip to content

Commit

Permalink
faster-deep-clone (prebid#11418)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaresic authored May 7, 2024
1 parent eb5ae98 commit 0b574b3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion allowedModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
],
'src': [
'fun-hooks/no-eval',
'just-clone',
'klona',
'dlv',
'dset'
],
Expand Down
2 changes: 1 addition & 1 deletion modules/browsiRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function addBrowsiTag(data) {
script.setAttribute('prebidbpt', 'true');
script.setAttribute('id', 'browsi-tag');
script.setAttribute('src', data.u);
script.prebidData = deepClone(data);
script.prebidData = deepClone(typeof data === 'string' ? Object(data) : data)
if (_moduleParams.keyName) {
script.prebidData.kn = _moduleParams.keyName;
}
Expand Down
25 changes: 14 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"express": "^4.15.4",
"fun-hooks": "^0.9.9",
"gulp-wrap": "^0.15.0",
"just-clone": "^1.0.2",
"klona": "^2.0.6",
"live-connect-js": "^6.3.4"
},
"optionalDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
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';
Expand Down Expand Up @@ -609,7 +609,7 @@ export function shuffle(array) {
}

export function deepClone(obj) {
return clone(obj);
return klona(obj) || {};
}

export function inIframe() {
Expand Down

0 comments on commit 0b574b3

Please sign in to comment.