@smithy/util-utf8
Advanced tools
Comparing version 2.0.2 to 2.1.0
@@ -1,5 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fromUtf8 = void 0; | ||
const fromUtf8 = (input) => new TextEncoder().encode(input); | ||
exports.fromUtf8 = fromUtf8; | ||
module.exports = require("./index.js"); |
@@ -1,9 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fromUtf8 = void 0; | ||
const util_buffer_from_1 = require("@smithy/util-buffer-from"); | ||
const fromUtf8 = (input) => { | ||
const buf = (0, util_buffer_from_1.fromString)(input, "utf8"); | ||
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT); | ||
}; | ||
exports.fromUtf8 = fromUtf8; | ||
module.exports = require("./index.js"); |
@@ -1,6 +0,55 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./fromUtf8"), exports); | ||
tslib_1.__exportStar(require("./toUint8Array"), exports); | ||
tslib_1.__exportStar(require("./toUtf8"), exports); | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
fromUtf8: () => fromUtf8, | ||
toUint8Array: () => toUint8Array, | ||
toUtf8: () => toUtf8 | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
// src/fromUtf8.ts | ||
var import_util_buffer_from = require("@smithy/util-buffer-from"); | ||
var fromUtf8 = /* @__PURE__ */ __name((input) => { | ||
const buf = (0, import_util_buffer_from.fromString)(input, "utf8"); | ||
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT); | ||
}, "fromUtf8"); | ||
// src/toUint8Array.ts | ||
var toUint8Array = /* @__PURE__ */ __name((data) => { | ||
if (typeof data === "string") { | ||
return fromUtf8(data); | ||
} | ||
if (ArrayBuffer.isView(data)) { | ||
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); | ||
} | ||
return new Uint8Array(data); | ||
}, "toUint8Array"); | ||
// src/toUtf8.ts | ||
var toUtf8 = /* @__PURE__ */ __name((input) => (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: | ||
0 && (module.exports = { | ||
fromUtf8, | ||
toUint8Array, | ||
toUtf8 | ||
}); |
@@ -1,14 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toUint8Array = void 0; | ||
const fromUtf8_1 = require("./fromUtf8"); | ||
const toUint8Array = (data) => { | ||
if (typeof data === "string") { | ||
return (0, fromUtf8_1.fromUtf8)(data); | ||
} | ||
if (ArrayBuffer.isView(data)) { | ||
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); | ||
} | ||
return new Uint8Array(data); | ||
}; | ||
exports.toUint8Array = toUint8Array; | ||
module.exports = require("./index.js"); |
@@ -1,5 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toUtf8 = void 0; | ||
const toUtf8 = (input) => new TextDecoder("utf-8").decode(input); | ||
exports.toUtf8 = toUtf8; | ||
module.exports = require("./index.js"); |
@@ -1,6 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toUtf8 = void 0; | ||
const util_buffer_from_1 = require("@smithy/util-buffer-from"); | ||
const toUtf8 = (input) => (0, util_buffer_from_1.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("utf8"); | ||
exports.toUtf8 = toUtf8; | ||
module.exports = require("./index.js"); |
{ | ||
"name": "@smithy/util-utf8", | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"description": "A UTF-8 string <-> UInt8Array converter", | ||
@@ -9,3 +9,3 @@ "main": "./dist-cjs/index.js", | ||
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'", | ||
"build:cjs": "yarn g:tsc -p tsconfig.cjs.json", | ||
"build:cjs": "node ../../scripts/inline util-utf8", | ||
"build:es": "yarn g:tsc -p tsconfig.es.json", | ||
@@ -15,3 +15,3 @@ "build:types": "yarn g:tsc -p tsconfig.types.json", | ||
"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\"", | ||
@@ -27,3 +27,3 @@ "format": "prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"", | ||
"dependencies": { | ||
"@smithy/util-buffer-from": "^2.0.0", | ||
"@smithy/util-buffer-from": "^2.1.0", | ||
"tslib": "^2.5.0" | ||
@@ -30,0 +30,0 @@ }, |
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
17804
88