diff --git a/doc/api/buffer.md b/doc/api/buffer.md index c94f03fa065a36..04040e324be39a 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -884,15 +884,18 @@ appropriate for `Buffer.from()` variants. ### Class Method: `Buffer.from(object[, offsetOrEncoding[, length]])` -* `object` {Object} An object supporting `Symbol.toPrimitive` or `valueOf()`. +* `object` {Object} An object supporting `valueOf()`. * `offsetOrEncoding` {integer|string} A byte-offset or encoding, depending on - the value returned either by `object.valueOf()` or - `object[Symbol.toPrimitive]()`. -* `length` {integer} A length, depending on the value returned either by - `object.valueOf()` or `object[Symbol.toPrimitive]()`. + the value returned by `object.valueOf()`. +* `length` {integer} A length, depending on the value returned by + `object.valueOf()`. For objects whose `valueOf()` function returns a value not strictly equal to `object`, returns `Buffer.from(object.valueOf(), offsetOrEncoding, length)`. @@ -902,20 +905,6 @@ const buf = Buffer.from(new String('this is a test')); // Prints: ``` -For objects that support `Symbol.toPrimitive`, returns -`Buffer.from(object[Symbol.toPrimitive](), offsetOrEncoding, length)`. - -```js -class Foo { - [Symbol.toPrimitive]() { - return 'this is a test'; - } -} - -const buf = Buffer.from(new Foo(), 'utf8'); -// Prints: -``` - A `TypeError` will be thrown if `object` has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants.