Echo JS 0.11.0

<~>

olalonde comments

olalonde 2927 days ago. link 1 point
Another one relatively simple:

    const promisify = fn => (...args) => new Promise(resolve, reject) {
      fn(...args, (err, result) => {
        if (err) return reject(err)
        resolve(result)
      }
    }
olalonde 2979 days ago. link 2 points
Author here. I assume you're referring to the Blockai organisation avatar? It's cute indeed :)

Shameless plug: we're looking to hire our first front end (React.js) / full stack engineer (oli@blockai.com).
olalonde 3999 days ago. link 1 point
Good job! By the way, can we get rid of the Telize advertisement at the top?
olalonde 4132 days ago. link 1 point
If your project is open source, you can also use Travis-CI for testing your code against multiple versions of node. There are also services for non open source projects. https://travis-ci.org/
olalonde 4133 days ago. link 1 point
Very cool! I'm not sure the bright ranking on the left really is really useful though.
olalonde 4133 days ago. link 1 point
This reminds me of one time I linked to a Github pull request on IRC and some random dude commented on about every single line of code to criticize my style. Felt pretty weird.
[comment deleted]
olalonde 4144 days ago. link 1 point
Can't wait for someone to come up with a more efficient library called Capitalistjs ;)
olalonde 4144 days ago. link 1 point
My favorite pattern are plain callbacks (plus Async library). It is also probably the most common pattern in Node.js land (although promises and events are also quite common). 

One reason I'm not personally a big fan of promises is that it makes it more verbose to pass around callbacks in some cases. For example:

Promise style:

    async.series([
      function (cb) {
        user.save()
          .success(function (user) { 
            cb(null, user); 
          }
          .error(cb);
      }
      // ...
    ], function (err) {
      // ...
    });


vs plain callback style:

    async.series([
      user.save.bind(user)
    ], function (err) {
      // ...
    });

Some other benefits of plain callback style: 

- Decoupling: how you handle the asynchronous code flow is up to you, not the library you are using. I personally like to use the "Async" library but it could easily be replaced by another library.

- Consistency: you don't have to worry about how the library you are using implements promises (some libraries have weird syntax/behavior).

edit: is there any way to format code snippets on EchoJS?
[more]