Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
631 B
Text
22 lines
631 B
Text
export default 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;
|
|
}
|
|
}
|