UNPKG

@pipedream/cincopa

Version:

Pipedream Cincopa Components

29 lines (21 loc) 507 B
import { ConfigurationError } from "@pipedream/platform"; function parseArray(value) { try { if (!value) { return []; } if (Array.isArray(value)) { return value; } const parsedValue = JSON.parse(value); if (!Array.isArray(parsedValue)) { throw new Error("Not an array"); } return parsedValue; } catch (e) { throw new ConfigurationError("Make sure the custom expression contains a valid array object"); } } export default { parseArray, };