0.1.3 • Published 8 years ago

filter-promise v0.1.3

Weekly downloads
26
License
BSD-3-Clause
Repository
-
Last release
8 years ago

Filter-Promise

Build Status

Library to bring human-oriented filtering for Promises.

Which problem do we solve?

This library bring simplified filtering on content of Promise to your favorite Promise library (Bluebird).

Examples

function getUserFromDB() {
   //...
   return Promise.resolve({
     name: 'John',
     age: '33'
   });
}

// with then-filter

const agedUser = getUserFromDB().then(filter( user => user.age > 30 ));


// without then-filter
const agedUser = getUserFromDB().then( user => {
    if(user.age > 30) return user;
    else throw new Error('User too young for that');
});

Notes

ES6-only. const and let are everywhere

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago