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.

34 lines (33 loc) 1.07 kB
import { __values } from "tslib"; import { escapeUri } from "@aws-sdk/util-uri-escape"; export function buildQueryString(query) { var e_1, _a; var parts = []; try { for (var _b = __values(Object.keys(query).sort()), _c = _b.next(); !_c.done; _c = _b.next()) { var key = _c.value; var value = query[key]; key = escapeUri(key); if (Array.isArray(value)) { for (var i = 0, iLen = value.length; i < iLen; i++) { parts.push(key + "=" + escapeUri(value[i])); } } else { var qsEntry = key; if (value || typeof value === "string") { qsEntry += "=" + escapeUri(value); } parts.push(qsEntry); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } return parts.join("&"); }