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
Uin8Array is emerging as the standard type for binary data in JavaScript, independent of Node.js's Buffer type. It would be very cool if a user could use Uin8Array input data directly in update() without wrapping it in a Buffer.
Right now this is prevented by an exception
functionthrowIfNotStringOrBuffer(val,prefix){if(!Buffer.isBuffer(val)&&typeofval!=='string'){thrownewTypeError(prefix+' must be a string or a buffer')}}// ..HashBase.prototype.update=function(data,encoding){throwIfNotStringOrBuffer(data,'Data')if(this._finalized)thrownewError('Digest already called')if(!Buffer.isBuffer(data))data=Buffer.from(data,encoding)
Uin8Array is emerging as the standard type for binary data in JavaScript, independent of Node.js's Buffer type. It would be very cool if a user could use Uin8Array input data directly in update() without wrapping it in a Buffer.
Right now this is prevented by an exception
Here is an Uint8Array type checker for inspiration: https://github.com/iov-one/iov-core/blob/v2.2.4/packages/iov-encoding/src/typechecks.ts#L1-L26
The text was updated successfully, but these errors were encountered: