UNPKG

serverless-spy

Version:

CDK-based library for writing elegant integration tests on AWS serverless architecture and an additional web console to monitor events in real time.

10 lines (9 loc) 317 B
export const numberSelector = (obj, key, type) => { if (!(key in obj)) return undefined; const numberValue = parseInt(obj[key], 10); if (Number.isNaN(numberValue)) { throw new TypeError(`Cannot load ${type} '${key}'. Expected number, got '${obj[key]}'.`); } return numberValue; };