Socket
Socket
Sign inDemoInstall

str2buf

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.2 to 1.3.0

2

dist/str2buf.js

@@ -1,2 +0,2 @@

function r(r){return r.reduce(function(r,n){return r+String.fromCharCode(n)},"")}function n(r){return new Uint8Array(r.length).map(function(n,t){return r.charCodeAt(t)})}function t(n){return r(new Uint8Array(n))}function e(r){return n(r).buffer}exports.fromUint8Array=r,exports.toUint8Array=n,exports.fromBuffer=t,exports.toBuffer=e;
function r(r){for(var t="",n=0,e=r.length;n<e;n++)t+=String.fromCharCode(r[n]);return t}function t(r){for(var t=new Uint8Array(r.length),n=0,e=r.length;n<e;n++)t[n]=r.charCodeAt(n);return t}function n(t){return r(new Uint8Array(t))}function e(r){return t(r).buffer}exports.fromUint8Array=r,exports.toUint8Array=t,exports.fromBuffer=n,exports.toBuffer=e;
//# sourceMappingURL=str2buf.js.map

@@ -1,2 +0,2 @@

!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.str2buf={})}(this,function(n){function r(n){return n.reduce(function(n,r){return n+String.fromCharCode(r)},"")}function t(n){return new Uint8Array(n.length).map(function(r,t){return n.charCodeAt(t)})}n.fromUint8Array=r,n.toUint8Array=t,n.fromBuffer=function(n){return r(new Uint8Array(n))},n.toBuffer=function(n){return t(n).buffer}});
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.str2buf={})}(this,function(n){function r(n){for(var r="",t=0,e=n.length;t<e;t++)r+=String.fromCharCode(n[t]);return r}function t(n){for(var r=new Uint8Array(n.length),t=0,e=n.length;t<e;t++)r[t]=n.charCodeAt(t);return r}n.fromUint8Array=r,n.toUint8Array=t,n.fromBuffer=function(n){return r(new Uint8Array(n))},n.toBuffer=function(n){return t(n).buffer}});
//# sourceMappingURL=str2buf.umd.js.map
{
"name": "str2buf",
"version": "1.2.2",
"description": "isomorphic string <=> buffer in 183 bytes",
"version": "1.3.0",
"description": "isomorphic string <=> buffer in 198 bytes",
"main": "node/str2buf.js",

@@ -12,3 +12,3 @@ "module": "node/str2buf.mjs",

"scripts": {
"build": "microbundle --entry browser.mjs --output dist && microbundle --entry node.mjs --output node && microbundle --entry browser-fast.mjs --output fast",
"build": "microbundle --entry browser.mjs --output dist && microbundle --entry node.mjs --output node",
"prepublish": "npm run build",

@@ -15,0 +15,0 @@ "pretest": "npm run build",

# str2buf [![NPM](https://img.shields.io/npm/v/str2buf.svg)](https://npmjs.com/package/str2buf) [![Build](https://travis-ci.org/kevlened/str2buf.svg?branch=master)](https://travis-ci.org/kevlened/str2buf)
isomorphic string <=> buffer in 183 bytes
isomorphic string <=> buffer in 198 bytes

@@ -36,10 +36,2 @@ ## Install

## I wanna go fast!
The Node implementation is just a proxy to Node's `Buffer` object to be as fast as possible. The default browser implementation optimizes for size, so if you're looking for raw speed, import like this:
```javascript
import str2buf from 'str2buf/fast/str2buf.mjs'
```
#### Perf profile

@@ -49,8 +41,2 @@

⏱ browser performance on 1000 arrays or strings of size 25003:
str2buf.fromUint8Array: 834.135ms
str2buf.toUint8Array: 771.099ms
str2buf.fromBuffer: 785.060ms
str2buf.toBuffer: 590.003ms
⏱ fast browser performance on 1000 arrays or strings of size 25003:
str2buf.fromUint8Array: 245.842ms

@@ -57,0 +43,0 @@ str2buf.toUint8Array: 165.240ms

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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