uuidjs / uuid

Generate RFC-compliant UUIDs in JavaScript
MIT License
14.61k stars 901 forks source link

Drop support for `offset` argument, commit to `Uint8Array` type for binary uuids #756

Closed broofa closed 3 months ago

broofa commented 5 months ago

The offset argument is a relic from before Uint8Array and ArrayBuffer types were widespread. Now that those types are widely adopted, users can create typed arrays with built-in offsets, obviating the need for us to support typed arrays. For example...

const arr1 = new Uint8Array(1024);
const arr2 = new Uint8Array(arr1.buffer, 16);
arr2[0] = 123;
console.log(arr1[16]); // <-- "123"

This assumes we commit to Uint8Array for binary uuid types, however. See #755

This would be a breaking change, of course.

broofa commented 3 months ago

Closing. In light of recent v11 work, I just don't think it's worth the API disruption at this time.