Socket
Socket
Sign inDemoInstall

arraybuffer.prototype.slice

Package Overview
Dependencies
64
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    arraybuffer.prototype.slice

ES spec-compliant shim for ArrayBuffer.prototype.slice


Version published
Weekly downloads
22M
increased by0.19%
Maintainers
1
Install size
3.58 MB
Created
Weekly downloads
 

Changelog

Source

v1.0.3 - 2024-02-04

Commits

  • [Deps] update array-buffer-byte-length, call-bind, define-properties, es-abstract, get-intrinsic, is-array-buffer d9b6859
  • [Dev Deps] update aud, npmignore, object-inspect, tape 38cb58d
  • [Refactor] use es-errors where possible, so things that only need those do not need get-intrinsic 5c07bef

Readme

Source

ArrayBuffer.prototype.slice Version Badge

github actions coverage License Downloads

npm badge

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

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

Most common usage:

var assert = require('assert');
var slice = require('arraybuffer.prototype.slice');

var ab = new ArrayBuffer(1);
var arr = new Uint8Array(ab);
arr[0] = 123;

var ab2 = slice(ab);

var arr2 = new Uint8Array(ab2);
arr2[0] = 234;

assert.deepEqual(arr, new Uint8Array([123]));
assert.deepEqual(arr2, new Uint8Array([234]));

if (!ArrayBuffer.prototype.transfer) {
	slice.shim();
}

var ab2 = ab.slice();

var arr2 = new Uint8Array(ab2);
arr2[0] = 234;

assert.deepEqual(arr, new Uint8Array([123]));
assert.deepEqual(arr2, new Uint8Array([234]));

Tests

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

Keywords

FAQs

Last updated on 05 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc