UNPKG

@eightshone/sshman

Version:
27 lines 955 B
function validateServers(value) { if (!Array.isArray(value)) return false; return value.every((item) => { if (typeof item !== "object" || item === null || (!!item.id && typeof item.id !== "string") || typeof item.name !== "string" || typeof item.host !== "string" || typeof item.port !== "number" || typeof item.username !== "string" || typeof item.usePassword !== "boolean") { return false; } const connectivity = item; // check connectivity union type if (connectivity.usePassword === true) { return typeof connectivity.password === "string"; } else if (connectivity.usePassword === false) { return typeof connectivity.privateKey === "string"; } return false; }); } export default validateServers; //# sourceMappingURL=validateServers.js.map