Socket
Socket
Sign inDemoInstall

typedarray-to-buffer

Package Overview
Dependencies
1
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.4 to 3.0.5

6

index.js

@@ -9,2 +9,3 @@ /**

*/
/* eslint-disable no-proto */

@@ -17,3 +18,6 @@ var isTypedArray = require('is-typedarray').strict

var constructor = Buffer.TYPED_ARRAY_SUPPORT
? Buffer._augment
? function (arr) {
arr.__proto__ = Buffer.prototype
return arr
}
: function (arr) { return new Buffer(arr) }

@@ -20,0 +24,0 @@

2

package.json
{
"name": "typedarray-to-buffer",
"description": "Convert a typed array to a Buffer without a copy",
"version": "3.0.4",
"version": "3.0.5",
"author": {

@@ -6,0 +6,0 @@ "name": "Feross Aboukhadijeh",

@@ -7,3 +7,3 @@ # typedarray-to-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][npm-url]

[travis-image]: https://img.shields.io/travis/feross/typedarray-to-buffer.svg?style=flat
[travis-image]: https://img.shields.io/travis/feross/typedarray-to-buffer/master.svg?style=flat
[travis-url]: https://travis-ci.org/feross/typedarray-to-buffer

@@ -10,0 +10,0 @@ [npm-image]: https://img.shields.io/npm/v/typedarray-to-buffer.svg?style=flat

@@ -21,3 +21,3 @@ var test = require('tape')

test('convert to buffer from another arrayview type (Uint32Array)', function (t) {
if (typeof Uint32Array !== 'undefined') {
if (typeof Uint32Array !== 'undefined' && Buffer.TYPED_ARRAY_SUPPORT !== false) {
var arr = new Uint32Array([1, 2, 3])

@@ -31,3 +31,3 @@ arr = toBuffer(arr)

t.equal(arr.readUInt32LE(8), 3)
t.equal(arr instanceof Uint8Array, !!Buffer.TYPED_ARRAY_SUPPORT)
t.equal(arr instanceof Uint8Array, true)
} else {

@@ -40,3 +40,3 @@ t.pass('browser lacks Uint32Array support, skip test')

test('convert to buffer from ArrayBuffer', function (t) {
if (typeof Uint32Array !== 'undefined') {
if (typeof Uint32Array !== 'undefined' && Buffer.TYPED_ARRAY_SUPPORT !== false) {
var arr = new Uint32Array([1, 2, 3]).subarray(1, 2)

@@ -48,3 +48,3 @@ arr = toBuffer(arr)

t.equal(arr.readUInt32LE(0), 2)
t.equal(arr instanceof Uint8Array, !!Buffer.TYPED_ARRAY_SUPPORT)
t.equal(arr instanceof Uint8Array, true)
} else {

@@ -51,0 +51,0 @@ t.pass('browser lacks ArrayBuffer support, skip test')

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