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.

23 lines (22 loc) 644 B
class boolParser{ constructor(trueList, falseList){ if(trueList) this.trueList = trueList; else this.trueList = ["true"]; if(falseList) this.falseList = falseList; else this.falseList = ["false"]; } parse(val){ if (typeof val === 'string') { //TODO: performance: don't convert const temp = val.toLowerCase(); if(this.trueList.indexOf(temp) !== -1) return true; else if(this.falseList.indexOf(temp) !== -1 ) return false; } return val; } } module.exports = boolParser;