Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/regou/auto-pilot
Auto pilot your es6 generator functions
https://github.com/regou/auto-pilot
Last synced: about 1 month ago
JSON representation
Auto pilot your es6 generator functions
- Host: GitHub
- URL: https://github.com/regou/auto-pilot
- Owner: regou
- License: apache-2.0
- Created: 2015-06-09T12:50:43.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-18T10:35:40.000Z (over 8 years ago)
- Last Synced: 2024-11-11T10:47:05.185Z (about 2 months ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# auto-pilot
Auto pilot your es6 generator functions### Usage Example
```js
var autopilot = require('auto-pilot');var joint = function *(input){
var name = yield httpRequestData(input); //yield a promise 'httpRequestData' resolve ' World!'
var str = yield function(){return 'Hello! ' + name; }; //also can yield a function
return str;
};autopilot(joint('An example string')).then(function(str){
console.log(str) // 'Hello! World!'
},function(err){
console.warn(err);
});
```### Use in angularjs
```js
function customPromiseCreator(func){
return $q(func);
}
autopilot(joint('Exaple string'),customPromiseCreator);```
### Notice
Require a global Promise polyfill### Develop/Test
`$ npm install`
`$ npm run test`