@smithy/util-body-length-browser
Advanced tools
Comparing version 2.0.0 to 2.0.1
"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--) { |
{ | ||
"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": { |
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
16182
5
77