Closed fengzilong closed 3 years ago
.getLanguage
resolving an alias might be unintuitive?Would perhaps a registered(aliasOrLanguage): boolean
work?
It makes sense for me. Already rename to registered
and return a boolean
type
I'm spoiled by Wren lately but I'd suggest isRegistered
. :-)
I'm spoiled by Wren lately but I'd suggest
isRegistered
. :-)
Both is ok for me 😉. @wooorm What's your opinion on the naming?
@joshgoebel What’s “Wren”?
It’s a bit of an unimportant stylistic choice, whether to prefix with is*
or has*
. I’ve done that before but personally am more in favor of without the prefix. It’s unambiguous enough in my opinion!
@fengzilong Could you add a test? And docs?
@wooorm I'm truly spoiled by Ruby where we have registered?
... I think isRegistered
(to me) has a bit more of that "flavor"...
@fengzilong Could you add a test? And docs?
I'll add test & docs soon when I get off work
@fengzilong Could you add a test? And docs?
Test and docs added
updated
Thanks @fengzilong! (and @joshgoebel)
In the following case
lowhight.listLanguages()
doesn't includealias
, so there is no method exposed to tell us whether an alias is registeredThis problem can be solved by exposing
lowlight.getLanguage
BTW, I found someone use
highlight.listLanguages
to build a Select component in browser, so I decide to send a PR here rather than highlight.js repository