MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / toDataView

Function toDataView

src/misc.ts:337–345  ·  view source on GitHub ↗
(source: AllowSharedBufferSource)

Source from the content-addressed store, hash-verified

335};
336
337export const toDataView = (source: AllowSharedBufferSource): DataView => {
338 if (source.constructor === DataView) {
339 return source;
340 } else if (ArrayBuffer.isView(source)) {
341 return new DataView(source.buffer, source.byteOffset, source.byteLength);
342 } else {
343 return new DataView(source);
344 }
345};
346
347export const promiseWithResolvers = <T = void>() => {
348 let resolve: (value: T) => void;

Callers 2

copyToMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected