Changeset e29cc2e for trip-planner-front/node_modules/p-limit
- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- Location:
- trip-planner-front/node_modules/p-limit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/node_modules/p-limit/index.d.ts
r59329aa re29cc2e 1 declare namespace pLimit { 2 interface Limit { 3 /** 4 The number of promises that are currently running. 5 */ 6 readonly activeCount: number; 1 export interface Limit { 2 /** 3 @param fn - Promise-returning/async function. 4 @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions. 5 @returns The promise returned by calling `fn(...arguments)`. 6 */ 7 <Arguments extends unknown[], ReturnType>( 8 fn: (...arguments: Arguments) => PromiseLike<ReturnType> | ReturnType, 9 ...arguments: Arguments 10 ): Promise<ReturnType>; 7 11 8 9 The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).10 11 readonly pendingCount: number;12 /** 13 The number of promises that are currently running. 14 */ 15 readonly activeCount: number; 12 16 13 /** 14 Discard pending promises that are waiting to run. 17 /** 18 The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). 19 */ 20 readonly pendingCount: number; 15 21 16 This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. 22 /** 23 Discard pending promises that are waiting to run. 17 24 18 Note: This does not cancel promises that are already running. 19 */ 20 clearQueue: () => void; 25 This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. 21 26 22 /** 23 @param fn - Promise-returning/async function. 24 @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions. 25 @returns The promise returned by calling `fn(...arguments)`. 26 */ 27 <Arguments extends unknown[], ReturnType>( 28 fn: (...arguments: Arguments) => PromiseLike<ReturnType> | ReturnType, 29 ...arguments: Arguments 30 ): Promise<ReturnType>; 31 } 27 Note: This does not cancel promises that are already running. 28 */ 29 clearQueue(): void; 32 30 } 33 31 … … 38 36 @returns A `limit` function. 39 37 */ 40 declare function pLimit(concurrency: number): pLimit.Limit; 41 42 export = pLimit; 38 export default function pLimit(concurrency: number): Limit; -
trip-planner-front/node_modules/p-limit/index.js
r59329aa re29cc2e 1 1 'use strict'; 2 const Queue = require('yocto-queue');2 const pTry = require('p-try'); 3 3 4 4 const pLimit = concurrency => { 5 5 if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) { 6 throw new TypeError('Expected `concurrency` to be a number from 1 and up');6 return Promise.reject(new TypeError('Expected `concurrency` to be a number from 1 and up')); 7 7 } 8 8 9 const queue = new Queue();9 const queue = []; 10 10 let activeCount = 0; 11 11 … … 13 13 activeCount--; 14 14 15 if (queue. size> 0) {16 queue. dequeue()();15 if (queue.length > 0) { 16 queue.shift()(); 17 17 } 18 18 }; 19 19 20 const run = async(fn, resolve, ...args) => {20 const run = (fn, resolve, ...args) => { 21 21 activeCount++; 22 22 23 const result = (async () => fn(...args))();23 const result = pTry(fn, ...args); 24 24 25 25 resolve(result); 26 26 27 try { 28 await result; 29 } catch {} 30 31 next(); 27 result.then(next, next); 32 28 }; 33 29 34 30 const enqueue = (fn, resolve, ...args) => { 35 queue.enqueue(run.bind(null, fn, resolve, ...args)); 36 37 (async () => { 38 // This function needs to wait until the next microtask before comparing 39 // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously 40 // when the run function is dequeued and called. The comparison in the if-statement 41 // needs to happen asynchronously as well to get an up-to-date value for `activeCount`. 42 await Promise.resolve(); 43 44 if (activeCount < concurrency && queue.size > 0) { 45 queue.dequeue()(); 46 } 47 })(); 31 if (activeCount < concurrency) { 32 run(fn, resolve, ...args); 33 } else { 34 queue.push(run.bind(null, fn, resolve, ...args)); 35 } 48 36 }; 49 37 50 const generator = (fn, ...args) => new Promise(resolve => { 51 enqueue(fn, resolve, ...args); 52 }); 53 38 const generator = (fn, ...args) => new Promise(resolve => enqueue(fn, resolve, ...args)); 54 39 Object.defineProperties(generator, { 55 40 activeCount: { … … 57 42 }, 58 43 pendingCount: { 59 get: () => queue. size44 get: () => queue.length 60 45 }, 61 46 clearQueue: { 62 47 value: () => { 63 queue. clear();48 queue.length = 0; 64 49 } 65 50 } … … 70 55 71 56 module.exports = pLimit; 57 module.exports.default = pLimit; -
trip-planner-front/node_modules/p-limit/license
r59329aa re29cc2e 1 1 MIT License 2 2 3 Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> ( https://sindresorhus.com)3 Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) 4 4 5 5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -
trip-planner-front/node_modules/p-limit/package.json
r59329aa re29cc2e 1 1 { 2 "_args": [ 3 [ 4 "p-limit@3.1.0", 5 "C:\\Users\\DELL\\Desktop\\bachelor-thesis\\trip-planner-front" 6 ] 7 ], 8 "_development": true, 9 "_from": "p-limit@3.1.0", 10 "_id": "p-limit@3.1.0", 2 "_from": "p-limit@^2.2.0", 3 "_id": "p-limit@2.3.0", 11 4 "_inBundle": false, 12 "_integrity": "sha512- TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",5 "_integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", 13 6 "_location": "/p-limit", 14 7 "_phantomChildren": {}, 15 8 "_requested": { 16 "type": " version",9 "type": "range", 17 10 "registry": true, 18 "raw": "p-limit@ 3.1.0",11 "raw": "p-limit@^2.2.0", 19 12 "name": "p-limit", 20 13 "escapedName": "p-limit", 21 "rawSpec": " 3.1.0",14 "rawSpec": "^2.2.0", 22 15 "saveSpec": null, 23 "fetchSpec": " 3.1.0"16 "fetchSpec": "^2.2.0" 24 17 }, 25 18 "_requiredBy": [ 26 "/ copy-webpack-plugin",27 "/ css-minimizer-webpack-plugin",28 "/ terser-webpack-plugin"19 "/import-local/p-locate", 20 "/p-locate", 21 "/yargs/p-locate" 29 22 ], 30 "_resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", 31 "_spec": "3.1.0", 32 "_where": "C:\\Users\\DELL\\Desktop\\bachelor-thesis\\trip-planner-front", 23 "_resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", 24 "_shasum": "3dd33c647a214fdfffd835933eb086da0dc21db1", 25 "_spec": "p-limit@^2.2.0", 26 "_where": "C:\\Users\\DELL\\Desktop\\bachelor-thesis\\trip-planner-front\\node_modules\\p-locate", 33 27 "author": { 34 28 "name": "Sindre Sorhus", 35 29 "email": "sindresorhus@gmail.com", 36 "url": " https://sindresorhus.com"30 "url": "sindresorhus.com" 37 31 }, 38 32 "bugs": { 39 33 "url": "https://github.com/sindresorhus/p-limit/issues" 40 34 }, 35 "bundleDependencies": false, 41 36 "dependencies": { 42 " yocto-queue": "^0.1.0"37 "p-try": "^2.0.0" 43 38 }, 39 "deprecated": false, 44 40 "description": "Run multiple promise-returning & async functions with limited concurrency", 45 41 "devDependencies": { 46 "ava": "^ 2.4.0",47 "delay": "^4. 4.0",48 "in-range": "^ 2.0.0",49 "random-int": "^ 2.0.1",50 "time-span": "^ 4.0.0",51 "tsd ": "^0.13.1",52 "xo": "^0. 35.0"42 "ava": "^1.2.1", 43 "delay": "^4.1.0", 44 "in-range": "^1.0.0", 45 "random-int": "^1.0.0", 46 "time-span": "^2.0.0", 47 "tsd-check": "^0.3.0", 48 "xo": "^0.24.0" 53 49 }, 54 50 "engines": { 55 "node": ">= 10"51 "node": ">=6" 56 52 }, 57 53 "files": [ … … 85 81 }, 86 82 "scripts": { 87 "test": "xo && ava && tsd "83 "test": "xo && ava && tsd-check" 88 84 }, 89 "version": " 3.1.0"85 "version": "2.3.0" 90 86 } -
trip-planner-front/node_modules/p-limit/readme.md
r59329aa re29cc2e 1 # p-limit 1 # p-limit [![Build Status](https://travis-ci.org/sindresorhus/p-limit.svg?branch=master)](https://travis-ci.org/sindresorhus/p-limit) 2 2 3 3 > Run multiple promise-returning & async functions with limited concurrency
Note:
See TracChangeset
for help on using the changeset viewer.