You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are functions named like MMELToText or MMELtokenize which is somewhat unconventional in JS/TS ecosystem.
One convention is that identifier name may not start with a capital letter, unless it’s a class (or in case of TS a type). Which means an initialism (e.g., MMEL) should be lowercased if you want to start function name with it. There are many examples of initialisms being lowercased in properties (e.g., bgColor or ariaSort). Not so many in functions, because functions tend to start with a verb.
Another convention, slightly more loose, is that function names that can easily start with a verb should. See many examples in Web APIs: you will see getAttribute, setHTML but not attributeGet or HTMLset. Which would suggest, e.g., tokenizeMMEL instead of MMELtokenize.
There are some exceptions to this convention, like conversion functions, in which case convertXToY is a bit long so you will just see xToY or even xtoy. However, they still follow the first rule, in that if initialism goes first it is lowercased. For example, you will see atob and btoa functions (where “a” is for “ASCII” and “b” is for “binary”) on the Web, and urlToHttpOptions and fileURLToPath in Node.
Additionally, there is a bit of internal inconsistency between MMELToText and MMELtokenize (something should be changed, either MMELtotext or MMELTokenize), but I think it should better be addressed by following the above conventions in the first place.
The text was updated successfully, but these errors were encountered:
There are functions named like
MMELToText
orMMELtokenize
which is somewhat unconventional in JS/TS ecosystem.One convention is that identifier name may not start with a capital letter, unless it’s a class (or in case of TS a type). Which means an initialism (e.g., MMEL) should be lowercased if you want to start function name with it. There are many examples of initialisms being lowercased in properties (e.g.,
bgColor
orariaSort
). Not so many in functions, because functions tend to start with a verb.Another convention, slightly more loose, is that function names that can easily start with a verb should. See many examples in Web APIs: you will see
getAttribute
,setHTML
but notattributeGet
orHTMLset
. Which would suggest, e.g.,tokenizeMMEL
instead ofMMELtokenize
.There are some exceptions to this convention, like conversion functions, in which case
convertXToY
is a bit long so you will just seexToY
or evenxtoy
. However, they still follow the first rule, in that if initialism goes first it is lowercased. For example, you will seeatob
andbtoa
functions (where “a” is for “ASCII” and “b” is for “binary”) on the Web, andurlToHttpOptions
andfileURLToPath
in Node.Additionally, there is a bit of internal inconsistency between
MMELToText
andMMELtokenize
(something should be changed, eitherMMELtotext
orMMELTokenize
), but I think it should better be addressed by following the above conventions in the first place.The text was updated successfully, but these errors were encountered: