0.0.1 • Published 7 years ago

promiter v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Promiter

Helper functions for promise arrays

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

To use this library you will need an installation of node and npm.

Installing

To install this library, you can simply use npm

npm install promiter

Or yarn if you prefer

yarn add promiter

Usage

After the install proccess completes you get a ES module, which you can use in the following way

import promiter from 'promiter'

Or if you only need part of the library

import {forEach} from 'promiter'

After you have imported the library, you can use it like so.

import {map, filter} from 'promiter'

const docs = [
  fetch('/docs/1'),
  fetch('/docs/2'),
  fetch('/docs/3'),
]

filter((res) => res.includes('party'), 
  map((res) => res.json(), docs)
)
.then(docs => {
  console.log('The following text includes the word party')
  console.log(docs)
})
.catch(err => {
  console.error(err)
})

License

This project is licensed under the MIT License - see the LICENSE.md file for details