How to use p-series - 7 common examples

To help you get started, we’ve selected a few p-series examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nikersify / jay / test / eval.ts View on Github external
const runBasicCases: RunBasicCases = (t, ev = createEvaluator().evaluate) => cases =>
	pSeries(cases.map(([input, expected]) => async () =>
		t.deepEqual(await ev(input), expected, input)
	)).then(() => {}) // eslint-disable-line promise/prefer-await-to-then
github zeebe-io / zeebe-modeler / client / src / app / App.js View on Github external
} else {
              const providerNames = tabsProvider.getProviderNames();

              await dialog.showOpenFileErrorDialog(getOpenFileErrorDialog({
                name,
                providerNames
              }));
            }
          }
        }

        return tab;
      };
    });

    const openResults = await pSeries(openTasks);

    // filter out empty elements
    const openedTabs = openResults.filter(openedTab => openedTab);

    return openedTabs.slice().reverse();
  }
github commercetools / nodejs / packages / custom-objects-importer / src / main.js View on Github external
// skip below because of flow issue with async/await
      // todo: remove `FlowFixMe` when [this](https://github.com/facebook/flow/issues/5294) issue is fixed
      // $FlowFixMe
    } = await this.client.execute(existingObjectsRequest)

    const requestsList = batches.map(
      (newObjects: Array): Array =>
        this._createOrUpdateObjects(existingObjects, newObjects)
    )

    const functionsList = requestsList.map(
      (requests: Array): Function =>
        this._createPromiseReturningFunction(requests)
    )

    return pSeries(functionsList).then((): Promise => Promise.resolve())
  }
github pastelsky / package-build-stats / tests / realWorldStats.js View on Github external
test('Sizes of popular UI Frameworks', async t => {
  const promises = UIPackages.map(pack => async () => {
    const res = await fetch(`${process.env.SERVER_ENDPOINT}/size?p=${encodeURIComponent(pack.name)}`)
    const json = await res.json()
    console.log(json, pack)
    t.truthy(isDeltaOk(json.size, pack.size), `Size delta too large, ${json.size - pack.size}`)
  })

  await pSeries(promises)
    .catch(r => console.log(r))
})
github teambit / bit / src / interactive / utils / run-interactive-cmd.js View on Github external
const writeInputsArray = async (inputsArr: InteractiveInput[]) => {
    const writeInputsP = inputsArr.map(wrapInputWriting);
    return pSeries(writeInputsP);
  };
github teambit / bit / src / interactive / utils / run-interactive-cmd.ts View on Github external
const writeInputsArray = async (inputsArr: InteractiveInput[]) => {
    const writeInputsP = inputsArr.map(wrapInputWriting);
    return pSeries(writeInputsP);
  };
github zeebe-io / zeebe-modeler / client / src / app / App.js View on Github external
saveAllTabs = () => {

    const {
      tabs
    } = this.state;

    const saveTasks = tabs
      .filter((tab) => {
        return this.isDirty(tab) || this.isUnsaved(tab);
      }).map((tab) => {
        return () => this.saveTab(tab);
      });

    return pSeries(saveTasks);
  }

p-series

Run promise-returning & async functions in series

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular p-series functions