Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrow functions / template strings? #100

Open
jpclair opened this issue Jan 17, 2017 · 0 comments
Open

Arrow functions / template strings? #100

jpclair opened this issue Jan 17, 2017 · 0 comments

Comments

@jpclair
Copy link
Contributor

jpclair commented Jan 17, 2017

Hi,
Several exercises (and solutions) are defined with arrow functions.
the exercise "decorate" for example:

seneca.decorate('stamp', (pattern) => {
  console.log(Date.now(), pattern)
})

Several exercises use templates strings,
the exercise "override" for example:

result.info = `${msg.left} + ${msg.right}`

It's quite cool, but it's quite confusing to have a mix between "old style" and "new style" Javascript.
It's not too difficult to fix that but I don't know what behaviour do you recommend for the projet.

Solution A (classic style)

this.prior(msg, function(err, result) {
   if (err) return respond(err)
   result.info = msg.left + " + " + msg.right
   respond(null, result)
})

Solution B (ES6 style)

this.prior(msg, (err, result) => {
      if (err) return respond(err)
      result.info = `${msg.left} + ${msg.right}`
      respond(null, result)
    })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants