Punctuation? Sign! Me! Up!
12 JanuaryWhat’s that you say? Question marks and exclamation points aren’t allowed in Javascript variable and function names?
Whatever, I do what I want:
class Switch {
get onʔ() { return this.status === 'on' }
get offʔ() { return this.status === 'off' }
get disabledʔ() { return this.status === 'disabled' }
disableǃ() {
if (this.status !== 'enabled') {
throw new MustBeEnabledError('no.')
}
this.status = 'disabled'
}
flipǃ() {
if (this.disabledʔ) { return }
this.status = this.onʔ ? 'off' : 'on'
}
}
Those technically aren’t question marks and exclamation points. They’re glottal stops and clicks - linguistic characters FTW. Bonus points for pronunciation.