UNPKG

@softchef/cdk-iot-device-management

Version:

IoT device management is composed of things, thing types, thing groups, jobs, files API services. The constructs can be used independently, that are based on full-managed service to create an API Gateway & Lambda function.

24 lines (23 loc) 714 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.calculateBodyLength = void 0; function calculateBodyLength(body) { if (typeof body === "string") { let len = body.length; for (let i = len - 1; i >= 0; i--) { const code = body.charCodeAt(i); if (code > 0x7f && code <= 0x7ff) len++; else if (code > 0x7ff && code <= 0xffff) len += 2; } return len; } else if (typeof body.byteLength === "number") { return body.byteLength; } else if (typeof body.size === "number") { return body.size; } } exports.calculateBodyLength = calculateBodyLength;