UNPKG

aws-parameter-store-env

Version:
50 lines (49 loc) 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function isArray(value) { return Array.isArray(value); } function isBoolean(value) { return typeof value === "boolean"; } exports.isBoolean = isBoolean; function isUndefined(value) { return typeof value === "undefined"; } function isFunction(value) { return typeof value === "function"; } exports.isFunction = isFunction; function isString(value) { return typeof value === "string" || value instanceof String; } exports.isString = isString; function validate(_a) { var parameters = _a.parameters, path = _a.path, region = _a.region, withDecryption = _a.withDecryption; if (!isArray(parameters)) { throw new Error("Unexpected value for option 'parameters'. Expected an array."); } else { parameters.forEach(function (parameter, index) { if (!isString(parameter.name)) { throw new Error("Unexpected value for attribute 'name' for parameter at index " + index + ". Expected a string."); } }); } if (!isString(path) && !isUndefined(path)) { throw new Error("Unexpected value for option 'path'. Expected a string or undefined."); } if (!isString(region)) { throw new Error("Unexpected value for option 'region'. Expected a string."); } if (!isBoolean(withDecryption) && !isUndefined(withDecryption)) { throw new Error("Unexpected value for option 'withDecryption'. Expected a boolean or undefined."); } return { parameters: parameters, path: path, region: region, withDecryption: withDecryption }; } exports.validate = validate;