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

ensure-string

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ensure-string - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

7

CHANGELOG.md
# Changelog
### [0.1.1](https://www.github.com/cheminfo/ensure-string/compare/v0.1.0...v0.1.1) (2021-04-28)
### Bug Fixes
* allow ArrayBuffer ([8d7abc1](https://www.github.com/cheminfo/ensure-string/commit/8d7abc1598b87c52c77155a61a6043642cd1cb3b))
## 0.1.0 (2021-04-27)

@@ -4,0 +11,0 @@

2

lib/index.js

@@ -15,3 +15,3 @@ 'use strict';

const { encoding = 'utf8' } = options;
if (ArrayBuffer.isView(blob)) {
if (ArrayBuffer.isView(blob) || blob instanceof ArrayBuffer) {
const decoder = new TextDecoder(encoding);

@@ -18,0 +18,0 @@ return decoder.decode(blob);

{
"name": "ensure-string",
"version": "0.1.0",
"version": "0.1.1",
"description": "Ensure that we receive a text even if an ArrayBuffer is sent",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -8,4 +8,8 @@ # ensure-string

Ensure that we receive a text even if an ArrayBuffer is sent.
If required, convert the input value to a string.
The input value may be a Buffer, ArrayBuffer, Int8Array. By default the conversion will consider that the text encoding is `utf8`.
If the input value is a text no change is done. The method returns the value without further processing.
## Installation

@@ -12,0 +16,0 @@

@@ -11,3 +11,3 @@ /**

const { encoding = 'utf8' } = options;
if (ArrayBuffer.isView(blob)) {
if (ArrayBuffer.isView(blob) || blob instanceof ArrayBuffer) {
const decoder = new TextDecoder(encoding);

@@ -14,0 +14,0 @@ return decoder.decode(blob);

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