pyramid-breaker

Sugar syntax to break the hell of pyramid code when dealing with asynchronous callbacks.

npm install pyramid-breaker
2 downloads in the last week
4 downloads in the last month

Pyramid Breaker

A nice syntaxic sugar to break down the pyramid syntax when dealing with asynchronous (and even synchronous) code in javascript.

Getting Started

Install the module with: npm install pyramid-breaker

var pyramid = require('pyramid-breaker');

Documentation

If you are interrested in the syntax and how it should be used, watch the tests. They are made to be clear and understandable by anyone.

Examples

The simplest example: executing some function with no handler

pyramid.do(function() {
  //regular code
})();

More complex: we execute a handler by the end of the execution of some function

var handling = pyramid.do(function(handler) {
  //some other code
  handler();
});
handling.with(function() {
  //some handling stuff
});
//once built, we launch the function with its handler
handling();

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

License

Copyright (c) 2013 Thomas Bracher
Licensed under the MIT license.

npm loves you