Closed salmanm closed 3 years ago
All versions of clone do not support copying Buffers. There are 2 different problems
const clone = require('rfdc')() const res = clone({ a: Buffer.from('ab') })
Actual Output
{ a: { '0': 97, '1': 98 } }
The buffer is incorrectly interpreted as an object and returned value is wrong.
Expected
{ a: <Buffer 61 62> }
const clone = require('rfdc')({ proto: true }) const res = clone({ a: Buffer.from('') })
Output
{ a: { readBigUInt64LE: [Function: readBigUInt64LE], readBigUInt64BE: [Function: readBigUInt64BE], readBigInt64LE: [Function: readBigInt64LE], readBigInt64BE: [Function: readBigInt64BE], writeBigUInt64LE: [Function: writeBigUInt64LE], ... } }
The buffer's internals are copied into output
All versions of clone do not support copying Buffers. There are 2 different problems
Scenario 1
Actual Output
The buffer is incorrectly interpreted as an object and returned value is wrong.
Expected
Scenario 2
Output
The buffer's internals are copied into output
Expected