UNPKG

compromise

Version:
22 lines (20 loc) 463 B
'use strict'; const words = require('./data') //prevent things like 'fifteen ten', and 'five sixty' const isValid = (w, has) => { if (words.ones[w]) { if (has.ones || has.teens) { return false; } } else if (words.teens[w]) { if (has.ones || has.teens || has.tens) { return false; } } else if (words.tens[w]) { if (has.ones || has.teens || has.tens) { return false; } } return true; }; module.exports = isValid