mirror of
https://github.com/nasa/openmct.git
synced 2024-12-24 07:16:39 +00:00
Updated guidance on anonymous functions
This commit is contained in:
parent
41dc9c794d
commit
a40ff07353
@ -144,9 +144,9 @@ JavaScript sources in Open MCT should:
|
|||||||
letters, with underscores between words (e.g. SOME_CONSTANT). They should always be declared as `const`s
|
letters, with underscores between words (e.g. SOME_CONSTANT). They should always be declared as `const`s
|
||||||
1. File names should be the name of the exported class, plus a .js extension
|
1. File names should be the name of the exported class, plus a .js extension
|
||||||
(e.g. SomeClassName.js).
|
(e.g. SomeClassName.js).
|
||||||
1. Avoid anonymous functions, except when functions are short (a few lines)
|
1. Avoid anonymous functions, except when functions are short (one or two lines)
|
||||||
and/or their inclusion makes sense within the flow of the code
|
and their inclusion makes sense within the flow of the code
|
||||||
(e.g. as arguments to a forEach call).
|
(e.g. as arguments to a forEach call). Anonymous functions should always be arrow functions.
|
||||||
1. Named functions are preferred over functions assigned to variables.
|
1. Named functions are preferred over functions assigned to variables.
|
||||||
eg.
|
eg.
|
||||||
```JavaScript
|
```JavaScript
|
||||||
|
Loading…
Reference in New Issue
Block a user