Comparing version 1.1.0 to 1.2.0
@@ -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) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6661
104
42
+ Addedto-array-buffer@3.2.0(transitive)
- Removedto-array-buffer@2.2.2(transitive)
Updatedto-array-buffer@^3.0.0