Socket
Socket
Sign inDemoInstall

@smithy/util-body-length-browser

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/util-body-length-browser - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

4

dist-cjs/calculateBodyLength.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateBodyLength = void 0;
const TEXT_ENCODER = typeof TextEncoder == "function" ? new TextEncoder() : null;
const calculateBodyLength = (body) => {
if (typeof body === "string") {
if (TEXT_ENCODER) {
return TEXT_ENCODER.encode(body).byteLength;
}
let len = body.length;

@@ -7,0 +11,0 @@ for (let i = len - 1; i >= 0; i--) {

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

const TEXT_ENCODER = typeof TextEncoder == "function" ? new TextEncoder() : null;
export const calculateBodyLength = (body) => {
if (typeof body === "string") {
if (TEXT_ENCODER) {
return TEXT_ENCODER.encode(body).byteLength;
}
let len = body.length;

@@ -4,0 +8,0 @@ for (let i = len - 1; i >= 0; i--) {

16

package.json
{
"name": "@smithy/util-body-length-browser",
"description": "Determines the length of a request body in browsers",
"version": "2.0.0",
"version": "2.0.1",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:es": "tsc -p tsconfig.es.json",
"build:types": "tsc -p tsconfig.types.json",
"build:cjs": "yarn g:tsc -p tsconfig.cjs.json",
"build:es": "yarn g:tsc -p tsconfig.es.json",
"build:types": "yarn g:tsc -p tsconfig.types.json",
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
"stage-release": "rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
"format": "prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"",
"test": "jest"
"test": "yarn g:jest"
},

@@ -48,6 +48,4 @@ "main": "./dist-cjs/index.js",

"downlevel-dts": "0.10.1",
"jest": "28.1.1",
"rimraf": "3.0.2",
"typedoc": "0.23.23",
"typescript": "~4.9.5"
"typedoc": "0.23.23"
},

@@ -54,0 +52,0 @@ "typedoc": {

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