Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

to-uint8

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to-uint8 - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

9

index.js

@@ -9,4 +9,7 @@ /* @module to-float32 */

var flat = require('flatten-vertex-data')
var isBase64 = require('is-base64')
module.exports = function tou8 (src, detectFloat) {
if (!src) return null
if (detectFloat == null) detectFloat = true

@@ -45,7 +48,9 @@

if (src.length != null && typeof src !== 'string') {
return new Uint8Array(src)
return new Uint8Array(src)
}
// non-array
return new Uint8Array(toab(src))
var buf = toab(src)
if (!buf) return null
return new Uint8Array(buf)
}
{
"name": "to-uint8",
"version": "1.1.0",
"version": "1.2.0",
"description": "Convert data to Uint8Array",

@@ -31,4 +31,4 @@ "main": "index.js",

"is-float-array": "^1.0.0",
"to-array-buffer": "^2.2.2"
"to-array-buffer": "^3.0.0"
}
}

@@ -15,3 +15,3 @@ # to-uint8 [![unstable](https://img.shields.io/badge/stability-unstable-green.svg)](http://github.com/badges/stability-badges)

Return Uint8Array `u8data` with input `data` values, possibly converted from floats, if required. `data` can be an array, array of arrays, typed array, buffer, arraybuffer, base64 string or any other container.
Return Uint8Array `u8data` with input `data` values, possibly converted from floats, if required. `data` can be an Array, Array of Arrays, TypedArray, Buffer, ArrayBuffer, base64 string or any other container.

@@ -30,2 +30,5 @@ ```js

u8([0, 1, 255], false) // <uint8 0, 255, 255>
// bad data returns null
u8(/abc/) // null
```

@@ -32,0 +35,0 @@

@@ -22,1 +22,4 @@ 'use strict'

a.deepEqual(u8([[0,0,0,0], [1,1,1,1]]), [0,0,0,0, 255,255,255,255])
a.equal(u8(null), null)
a.equal(u8(/abc/), null)
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc