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

@smithy/util-utf8

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/util-utf8 - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

10

dist-cjs/index.js

@@ -49,3 +49,11 @@ var __defProp = Object.defineProperty;

var toUtf8 = /* @__PURE__ */ __name((input) => (0, import_util_buffer_from.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("utf8"), "toUtf8");
var toUtf8 = /* @__PURE__ */ __name((input) => {
if (typeof input === "string") {
return input;
}
if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
}
return (0, import_util_buffer_from.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
}, "toUtf8");
// Annotate the CommonJS export names for ESM import in node:

@@ -52,0 +60,0 @@

@@ -1,1 +0,9 @@

export const toUtf8 = (input) => new TextDecoder("utf-8").decode(input);
export const toUtf8 = (input) => {
if (typeof input === "string") {
return input;
}
if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
}
return new TextDecoder("utf-8").decode(input);
};
import { fromArrayBuffer } from "@smithy/util-buffer-from";
export const toUtf8 = (input) => fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
export const toUtf8 = (input) => {
if (typeof input === "string") {
return input;
}
if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
}
return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
};

@@ -1,1 +0,7 @@

export declare const toUtf8: (input: Uint8Array) => string;
/**
*
* This does not convert non-utf8 strings to utf8, it only passes through strings if
* a string is received instead of a Uint8Array.
*
*/
export declare const toUtf8: (input: Uint8Array | string) => string;

@@ -1,1 +0,7 @@

export declare const toUtf8: (input: Uint8Array) => string;
/**
*
* This does not convert non-utf8 strings to utf8, it only passes through strings if
* a string is received instead of a Uint8Array.
*
*/
export declare const toUtf8: (input: Uint8Array | string) => string;

@@ -1,1 +0,7 @@

export declare const toUtf8: (input: Uint8Array) => string;
/**
*
* This does not convert non-utf8 strings to utf8, it only passes through strings if
* a string is received instead of a Uint8Array.
*
*/
export declare const toUtf8: (input: Uint8Array | string) => string;

@@ -1,1 +0,7 @@

export declare const toUtf8: (input: Uint8Array) => string;
/**
*
* This does not convert non-utf8 strings to utf8, it only passes through strings if
* a string is received instead of a Uint8Array.
*
*/
export declare const toUtf8: (input: Uint8Array | string) => string;

2

package.json
{
"name": "@smithy/util-utf8",
"version": "2.1.1",
"version": "2.2.0",
"description": "A UTF-8 string <-> UInt8Array converter",

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

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