Skip to content

Commit

Permalink
lib: make structuredClone spec compliant
Browse files Browse the repository at this point in the history
Fixes: #40246
  • Loading branch information
VoltrexKeyva committed Sep 29, 2021
1 parent 481c160 commit 8537f2e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/internal/structured_clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ const {
receiveMessageOnPort,
} = require('internal/worker/io');

const { validateObject } = require('internal/validators');

let channel;
function structuredClone(value, transfer) {
if (transfer !== undefined)
validateObject(transfer, 'transfer');

// TODO: Improve this with a more efficient solution that avoids
// instantiating a MessageChannel
channel ??= new MessageChannel();
Expand Down

0 comments on commit 8537f2e

Please sign in to comment.