mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
lib: replace Symbol.toPrimitive to SymbolToPrimitive primordials
PR-URL: https://github.com/nodejs/node/pull/30905 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
08728a1177
commit
e490b2ca90
2 files changed
+15
-14
No files matched your search
+3
-2
@@ -35,6 +35,7 @@ const {
|
||||
ObjectDefineProperty,
|
||||
ObjectSetPrototypeOf,
|
||||
Symbol,
|
||||
SymbolToPrimitive,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
@@ -297,8 +298,8 @@ Buffer.from = function from(value, encodingOrOffset, length) {
|
||||
if (b)
|
||||
return b;
|
||||
|
||||
if (typeof value[Symbol.toPrimitive] === 'function') {
|
||||
return Buffer.from(value[Symbol.toPrimitive]('string'),
|
||||
if (typeof value[SymbolToPrimitive] === 'function') {
|
||||
return Buffer.from(value[SymbolToPrimitive]('string'),
|
||||
encodingOrOffset,
|
||||
length);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user