JSPM

arraybuffer.prototype.transfertofixedlength

1.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q50567F
  • License MIT

ES Proposal spec-compliant shim for ArrayBuffer.prototype.transferToFixedLength

Package Exports

  • arraybuffer.prototype.transfertofixedlength
  • arraybuffer.prototype.transfertofixedlength/auto
  • arraybuffer.prototype.transfertofixedlength/implementation
  • arraybuffer.prototype.transfertofixedlength/package.json
  • arraybuffer.prototype.transfertofixedlength/polyfill
  • arraybuffer.prototype.transfertofixedlength/shim

Readme

ArrayBuffer.prototype.transferToFixedLength Version Badge

github actions coverage License Downloads

npm badge

An ES6 spec-compliant ArrayBuffer.prototype.transferToFixedLength shim. Invoke its "shim" method to shim ArrayBuffer.prototype.transferToFixedLength if it is unavailable.

This package implements the es-shim API interface. It works in an ES5-supported environment and complies with the proposed spec.

Most common usage:

var assert = require('assert');
var transferToFixedLength = require('arraybuffer.prototype.transfertofixedlength');
var IsDetachedBuffer = require('es-abstract/2023/IsDetachedBuffer');

var ab = new ArrayBuffer('a');

assert.equal(IsDetachedBuffer(ab), false);
transferToFixedLength(ab);
assert.equal(IsDetachedBuffer(ab), true);

if (!ArrayBuffer.prototype.transferToFixedLength) {
    transferToFixedLength.shim();
}

var ab2 = new ArrayBuffer('a');
assert.equal(IsDetachedBuffer(ab2), false);
ab2.transferToFixedLength();
assert.equal(IsDetachedBuffer(ab2), true);

Tests

Simply clone the repo, npm install, and run npm test