You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uint8Array.fromBase64Into and Uint8Array.fromHexInto don't match the normal naming and placement of methods:
Array.from, %TypedArray%.from, and the new Uint8Array.fromBase64 and Uint8Array.fromHex create new objects, indicated by the "from" prefix. from{Base64,Hex}Into don't create a new object, but instead modify existing objects. [1]
from{Base64,Hex}Into modify existing objects, but aren't placed on Uint8Array.prototype, but are instead methods placed on the constructor Uint8Array. [2]
I don't have concrete suggestions how to change this, but at least I wanted to open an issue, so in case the current names and placements will stay, it's documented that this was an intentional design choice.
[1] Here we could argue that the additional suffix "Into" indicates that the method doesn't create a new object.
[2] Here I'd guess the obvious explanation is that this improves discoverability when the names are similar to Uint8Array.from{Base64,Hex}.
The text was updated successfully, but these errors were encountered:
This was indeed an intentional design choice. The fromXInto methods are close cousins of the fromX methods, despite having a different return type.
I guess be OK with moving these to .prototype.setBase64 or something, but I'm a little happier with the current placement. I'll leave this open for now though.
Uint8Array.fromBase64Into
andUint8Array.fromHexInto
don't match the normal naming and placement of methods:Array.from
,%TypedArray%.from
, and the newUint8Array.fromBase64
andUint8Array.fromHex
create new objects, indicated by the "from" prefix.from{Base64,Hex}Into
don't create a new object, but instead modify existing objects. [1]from{Base64,Hex}Into
modify existing objects, but aren't placed onUint8Array.prototype
, but are instead methods placed on the constructorUint8Array
. [2]I don't have concrete suggestions how to change this, but at least I wanted to open an issue, so in case the current names and placements will stay, it's documented that this was an intentional design choice.
[1] Here we could argue that the additional suffix "Into" indicates that the method doesn't create a new object.
[2] Here I'd guess the obvious explanation is that this improves discoverability when the names are similar to
Uint8Array.from{Base64,Hex}
.The text was updated successfully, but these errors were encountered: