ericadamski / ericadamski/collaborative-edit

Use common CoffeeScript function patterns

Open
#9 3 comments 0 reactions 1 assignee Claimed by @ericadamski View on GitHub
enhancement
Dominant language
CoffeeScript
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Currently, a lot of the code base uses excessive parenthesis. By design CoffeeScript does not require parenthesis when invoking a function, unless the function takes no arguments, or some post-fix operators are used. Additionally, function signatures should conform with following pattern:

```
foo = (data, done) ->
#do something
```

Where `data` could be any number of parameters and `done` is the top-level callback.

For example the code [here](https://github.com/ericadamski/collaborative-edit/blob/develop/lib/Client/client_remote.coffee#L155) can be simplified:

This:

```
synchId = setInterval(
(-> remote.synchronize(shareJsDocContext)),
NO_OP_TIMEOUT
)
```

Becomes this with the `(data, done)` pattern and reduced parenthesis:

```
synchId = setInterval NO_OP_TIMEOUT, -> remote.synchronize shareJsDocContext
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.