GithubHelp home page GithubHelp logo

p-iteration's People

Contributors

toniov avatar robjtede avatar raederdev avatar

Stargazers

ramza avatar Anne Thorpe avatar nivethithan avatar MarginalEngineer avatar codesurfer.io avatar  avatar 李正 avatar Lei Xiao avatar Quang Lam avatar y3n avatar Taha Saifuddin avatar Yatharth Agarwal avatar Rick Clark avatar Thomas avatar Erik Nygren avatar Dmitry avatar  avatar P-Chan avatar Louis Cibot avatar Pierre-Yves Lebecq avatar Israel Gonzalez-Brooks avatar Yalun Zhu avatar Tema Smirnov avatar David Adam Coffey avatar Gwenaël Gallon avatar Ben avatar Rocktim avatar hoshide avatar Arun Kumar avatar netop://ウィビ avatar Jonathan Bispo avatar Alex Stotsky avatar . avatar Nick Lapshin avatar Erik avatar  avatar Johannes Homeier avatar Federico Degiovanni avatar Emerson Laurentino avatar Bright Chip avatar Gainor Bostwick avatar Andrei Vedovato avatar  avatar Peter Joles avatar Daniil Babanin avatar Florian Mettetal avatar Kollan House avatar Nikita Beznosikov avatar Yevhenii Lehkun avatar  avatar Slava Bereza avatar Petr Grishin avatar Dean Yao avatar Sebastian Tietz avatar Matheus Victor avatar MJ Delucchi avatar Adrien Becchis avatar Hassan Ben Jobrane avatar Jack Lam avatar Michelle Oliveira avatar Rohan Talip avatar Mussa Charles avatar Roy Fang avatar Anwar avatar Vaidesh Shankar avatar Jacky avatar Julien Michel avatar Xavier HEN avatar Alfredo Urdaneta avatar ellevuarts avatar Raymond Torino avatar Soumyajit Pathak avatar Mohammadreza avatar Darcy Turk avatar zentus avatar  avatar zjaml avatar Dor Shtaif avatar Mahmoud Masri avatar JackKCWong avatar  avatar Alexey Zaharchenko avatar Che Fisher avatar seungdols avatar  avatar Daniel Perez avatar Hieu Vo avatar Matheus Alves avatar  avatar Naoki Sawada avatar Takahashi Yuki avatar Shaun avatar Ayan Yenbekbay avatar Benjamin Jesuiter avatar Anas TIOUR avatar RoyMcCrain avatar Bruno Crosier avatar xlitter avatar web master avatar Stathis Ntonas avatar

Watchers

Kévin Perrée avatar  avatar JK avatar Park Sang kil avatar Todd E. Magnusson avatar Chico avatar nakawankuma avatar  avatar

p-iteration's Issues

Add mapParallel and forEachParallel

Would be nice to see a forEach that allowed for parallel execution..

  • mapParallel(array, options, callback, [thisArg])
  • forEachParallel(array, options, callback, [thisArg])

options

  • concurrency: number, min: 1, max: ????
    • The number of in-flight/unresolved concurrent operations to start.

Support for other types that implement Symbol.iterator

Hi!

Would be a super awesome feature if the library would also support types other than plain Arrays that implement Symbol.iterator. If the library would use for ... of internally this could be fairly easy to implement for most methods.

Take over maintenance

Hey @toniov ,

first off, thank you so much for working on this project. It has helped to create great APIs in webdriver.io.

I've seen that this package hasn't seen much updates lately and was wondering what the state of maintenance is. I am currently rewriting the WebdriverIO project from CJS to ESM and have some difficulties using the CJS version of this package. I wonder if you are planning to continue contribute to it or if you like me to take over maintenance on behalf of the WebdriverIO team.

Let me know what you think.

Have a great day!

Unexpected token

The following error gets thrown from simply loading the library (not even calling it).

Why does this happen? Am using node 8.1.0

import { forEach } from 'p-iteration';

OR

const { forEach } = require('p-iteration');

throws same error:

exports.forEach = async (array, callback, thisArg) => {
                        ^
SyntaxError: Unexpected token (
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)

"Failed to minify the code"

Hi, I'm having an issue when using this library in a react project. The issue seems to that the lib is not ES5 compiled? When trying to build my project, I get the error:

Failed to minify the code from this file: ./node_modules/p-iteration/lib/static-methods.js:11

Could it be something missing on my part?

Is it possible to use in a chain?

It is common in libraries like this, to have a chain method, to allow you to use the methods in a chain without aux variables or putting one call inside the other.

Example:

const { chain } = require('p-iteration');

const usersIds = [1, 2, 3];
const users = await chain(usersIds)
  .map(async id => await getById(id))
  .filter(async user => await checkIsActive(user.anotherId))
  .value()

Is it possible to use an async chain?

Does not compile in error es2016 preset?

[16:35:09] Error: Couldn't find preset "es2016" relative to directory "C:\src\w-azure\WebSite\w\node_modules\p-iteration" while parsing file: C:\src\w-azure\WebSite\w\node_modules\p-iteration\index.js

I buling project uses
React, Browserify, Babel(es2015), Gulp and others...
I've import P-iteration so have compile error .
I can send project information.
If you have the necessary information, please say me.

Possible to limit the number of concurrent iterations?

Thanks for the package! I love the simplicity of the useage!

We've been using p-map as well in some projects but due to the "structure" of it it is sometimes much easier to use your module but in p-map there is a parameter to limit the number of concurrent "threads", {concurrency: 2}

Is the same possible using your module?

Safari Support

Hi,

Thank you for this great library. I have been testing whether to use it or not and it seems to work very well on chrome, Firefox, edge and opera but on safari I get an error. I am using function like your second example

async function getRawResponses (userIds) {
  const responses = await map(userIds, userId => fetch(`/api/users/${userId}`));
  // ... do some stuff
  return responses;
}

The error I am getting is in this section

exports.everySeries = async (array, callback, thisArg) => {
  for (let i = 0; i < array.length; i++) {
    if (i in array && !await callback.call(thisArg || this, await array[i], i, array)) {
      return false;
    }
  }
  return true;
};

at the if statement and error is:

Unexpected identifier 'callback'. Expected ')' to end an if

Have you experienced this issue and if so can it be fixed? Otherwise I need to go with less clean Promise.all option available but I would prefer to use this if possible.

Collaborate on asyncp

Hi @toniov! Great stuff with p-iteration! I wanted to share a project I started a while back which is a port of the async.js library to use native promises. All of the methods you've implemented in p-iteration are also available in asyncp. It would be nice to collaborate and work on asyncp together.

jgornick/asyncp

Let me know what you think. Thanks!

Typing issue: async function not accepted as `forEach` callback

In the current TypeScript type definitions, the forEach function is declared as:

export const forEach: <T>(
  array: T[],
  callback: (currentValue: T, index: number, array: T[]) => void,
  thisArg?: any
) => Promise<void>;

See index.d.ts.

This signature implies that the callback must return void.
However, the documentation states that it should be asynchronious:

Allow the usage of async functions as callback

See README.md.

I guess, the function should return void | Promise<void>.

The current definition produces the linter error:

Promise returned in function argument where a void return was expected @typescript-eslint/no-misused-promises

See no-misused-promises.

Could you please consider updating the typing?

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.