First release

This commit is contained in:
Owen Quinlan 2021-07-02 19:29:34 +10:00
commit fa6c85266e
2339 changed files with 761050 additions and 0 deletions

21
node_modules/throttles/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,21 @@
module.exports = function (limit) {
limit = limit || 1;
var queue=[], wip=0;
function toAdd(fn) {
queue.push(fn) > 1 || run(); // initializes if 1st
}
function isDone() {
wip--; // make room for next
run();
}
function run() {
if (wip < limit && queue.length > 0) {
queue.shift()(); wip++; // is now WIP
}
}
return [toAdd, isDone];
}

1
node_modules/throttles/dist/index.min.js generated vendored Normal file
View file

@ -0,0 +1 @@
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=function(n){n=n||1;var t=[],f=0;function u(){f<n&&t.length>0&&(t.shift()(),f++)}return[function(n){t.push(n)>1||u()},function(){f--,u()}]}:"function"==typeof define&&define.amd?define(t):n.throttles=function(n){n=n||1;var t=[],f=0;function u(){f<n&&t.length>0&&(t.shift()(),f++)}return[function(n){t.push(n)>1||u()},function(){f--,u()}]}}(this,(function(){return function(n){n=n||1;var t=[],f=0;function u(){f<n&&t.length>0&&(t.shift()(),f++)}return[function(n){t.push(n)>1||u()},function(){f--,u()}]}}));

21
node_modules/throttles/dist/index.mjs generated vendored Normal file
View file

@ -0,0 +1,21 @@
export default function (limit) {
limit = limit || 1;
var queue=[], wip=0;
function toAdd(fn) {
queue.push(fn) > 1 || run(); // initializes if 1st
}
function isDone() {
wip--; // make room for next
run();
}
function run() {
if (wip < limit && queue.length > 0) {
queue.shift()(); wip++; // is now WIP
}
}
return [toAdd, isDone];
}

13
node_modules/throttles/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,13 @@
declare module 'throttles' {
type isDone = () => void;
type toAdd = (fn: Function) => void;
function throttles(limit?: number): [toAdd, isDone];
export = throttles;
}
declare module 'throttles/priority' {
type isDone = () => void;
type toAdd = (fn: Function, isHigh?: boolean) => void;
function throttles(limit?: number): [toAdd, isDone];
export = throttles;
}

21
node_modules/throttles/license generated vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
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:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

74
node_modules/throttles/package.json generated vendored Normal file
View file

@ -0,0 +1,74 @@
{
"_args": [
[
"throttles@1.0.1",
"F:\\Documents\\websites\\BMM"
]
],
"_from": "throttles@1.0.1",
"_id": "throttles@1.0.1",
"_inBundle": false,
"_integrity": "sha512-fab7Xg+zELr9KOv4fkaBoe/b3L0GMGLd0IBSCn16GoE/Qx6/OfCr1eGNyEcDU2pUA79qQfZ8kPQWlRuok4YwTw==",
"_location": "/throttles",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "throttles@1.0.1",
"name": "throttles",
"escapedName": "throttles",
"rawSpec": "1.0.1",
"saveSpec": null,
"fetchSpec": "1.0.1"
},
"_requiredBy": [
"/quicklink"
],
"_resolved": "https://registry.npmjs.org/throttles/-/throttles-1.0.1.tgz",
"_spec": "1.0.1",
"_where": "F:\\Documents\\websites\\BMM",
"author": {
"name": "Luke Edwards",
"email": "luke.edwards05@gmail.com",
"url": "https://lukeed.com"
},
"bugs": {
"url": "https://github.com/lukeed/throttles/issues"
},
"description": "A tiny (139B to 204B) utility to regulate the execution rate of your functions",
"devDependencies": {
"bundt": "1.0.1",
"esm": "3.2.25",
"uvu": "0.0.14"
},
"engines": {
"node": ">=6"
},
"files": [
"index.d.ts",
"priority",
"dist"
],
"homepage": "https://github.com/lukeed/throttles#readme",
"license": "MIT",
"main": "dist/index.js",
"modes": {
"default": "src/single.js",
"priority": "src/priority.js"
},
"module": "dist/index.mjs",
"name": "throttles",
"repository": {
"type": "git",
"url": "git+https://github.com/lukeed/throttles.git"
},
"scripts": {
"build": "bundt",
"postbuild": "cp priority.d.ts priority/index.d.ts",
"pretest": "npm run build",
"test": "uvu -r esm test -i utils"
},
"types": "index.d.ts",
"unpkg": "dist/index.min.js",
"version": "1.0.1"
}

4
node_modules/throttles/priority/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,4 @@
type isDone = () => void;
type toAdd = (fn: Function, isHigh?: boolean) => void;
declare function throttles(limit?: number): [toAdd, isDone];
export default throttles;

31
node_modules/throttles/priority/index.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
module.exports = function (limit) {
limit = limit || 1;
var qlow=[], idx, qhigh=[], sum=0, wip=0;
function toAdd(fn, isHigh) {
if (fn.__t) {
if (isHigh) {
idx = qlow.indexOf(fn);
// must decrement (increments again)
if (!!~idx) qlow.splice(idx, 1).length && sum--;
} else return;
}
fn.__t = 1;
(isHigh ? qhigh : qlow).push(fn);
sum++ || run(); // initializes if 1st
}
function isDone() {
wip--; // make room for next
run();
}
function run() {
if (wip < limit && sum > 0) {
(qhigh.shift() || qlow.shift())();
sum--; wip++; // is now WIP
}
}
return [toAdd, isDone];
}

1
node_modules/throttles/priority/index.min.js generated vendored Normal file
View file

@ -0,0 +1 @@
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=function(n){n=n||1;var t,i=[],f=[],e=0,u=0;function o(){u<n&&e>0&&((f.shift()||i.shift())(),e--,u++)}return[function(n,u){if(n.__t){if(!u)return;~(t=i.indexOf(n))&&i.splice(t,1).length&&e--}n.__t=1,(u?f:i).push(n),e++||o()},function(){u--,o()}]}:"function"==typeof define&&define.amd?define(t):n.throttles=function(n){n=n||1;var t,i=[],f=[],e=0,u=0;function o(){u<n&&e>0&&((f.shift()||i.shift())(),e--,u++)}return[function(n,u){if(n.__t){if(!u)return;~(t=i.indexOf(n))&&i.splice(t,1).length&&e--}n.__t=1,(u?f:i).push(n),e++||o()},function(){u--,o()}]}}(this,(function(){return function(n){n=n||1;var t,i=[],f=[],e=0,u=0;function o(){u<n&&e>0&&((f.shift()||i.shift())(),e--,u++)}return[function(n,u){if(n.__t){if(!u)return;~(t=i.indexOf(n))&&i.splice(t,1).length&&e--}n.__t=1,(u?f:i).push(n),e++||o()},function(){u--,o()}]}}));

31
node_modules/throttles/priority/index.mjs generated vendored Normal file
View file

@ -0,0 +1,31 @@
export default function (limit) {
limit = limit || 1;
var qlow=[], idx, qhigh=[], sum=0, wip=0;
function toAdd(fn, isHigh) {
if (fn.__t) {
if (isHigh) {
idx = qlow.indexOf(fn);
// must decrement (increments again)
if (!!~idx) qlow.splice(idx, 1).length && sum--;
} else return;
}
fn.__t = 1;
(isHigh ? qhigh : qlow).push(fn);
sum++ || run(); // initializes if 1st
}
function isDone() {
wip--; // make room for next
run();
}
function run() {
if (wip < limit && sum > 0) {
(qhigh.shift() || qlow.shift())();
sum--; wip++; // is now WIP
}
}
return [toAdd, isDone];
}

119
node_modules/throttles/readme.md generated vendored Normal file
View file

@ -0,0 +1,119 @@
# throttles [![build status](https://badgen.now.sh/github/status/lukeed/throttles)](https://github.com/lukeed/throttles/actions) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/throttles)](https://codecov.io/gh/lukeed/throttles)
> A tiny (139B to 204B) utility to regulate the execution rate of your functions
## Install
```
$ npm install --save throttles
```
## Modes
There are two "versions" of `throttles`, each of which different purpose:
#### "single"
> **Size (gzip):** 139 bytes<br>
> **Availability:** [UMD](https://unpkg.com/throttles), [CommonJS](https://unpkg.com/throttles/dist/index.js), [ES Module](https://unpkg.com/throttles?module)
This is the primary/default mode, meant for managing single queues.
#### "priority"
> **Size (gzip):** 204 bytes<br>
> **Availability:** [UMD](https://unpkg.com/throttles/priority), [ES Module](https://unpkg.com/throttles/priority/index.mjs)
This is the opt-in mode, meant for managing a low priority _and_ a high priority queue system.<br>
Items within the "high priority" queue are handled before the low/general queue. The `limit` is still enforced.
## Usage
***Selecting a Mode***
```js
// import via npm module
import throttles from 'throttles';
import throttles from 'throttles/priority';
// import via unpkg
import throttles from 'https://unpkg.com/throttles/index.mjs';
import throttles from 'https://unpkg.com/throttles/priority/index.mjs';
```
***Example Usage***
```js
import throttles from 'throttles';
const API = 'https://pokeapi.co/api/v2/pokemon';
const getPokemon = id => fetch(`${API}/${id}`).then(r => r.json());
// Limit concurrency to 3
const [toAdd, isDone] = throttles(3);
// What we'll fetch
const pokemon = ['bulbasaur', 'ivysaur', 'venusaur', 'charmander', 'charmeleon', 'charizard', ...];
// Loop list, enqueuing each Pokemon
// ~> Always keeps 3 requests active at a time
// ~> When complete, marks itself complete via `isDone()`
pokemon.forEach(name => {
toAdd(() => {
getPokemon(name).then(isDone);
});
});
// Or, use `Array.map` to wrap our `getPokemon` function
// ~> This still fetches Pokemon 3 at once
pokemon.map(x => () => getPokemon(x).then(isDone)).forEach(toAdd);
```
## API
### throttles(limit)
Returns: `Array`
Returns a tuple of [[`toAdd`](#toaddfn-ishigh), [`isDone`](#isdone)] actions.
#### limit
Type: `Number`<br>
Default: `1`
The throttle's concurrency limit. By default, runs your functions one at a time.
### toAdd(fn[, isHigh])
Type: `Function`<br>
Returns: `void`
Add a function to the throttle's queue.
> **Important:** In "priority" mode, identical functions are ignored.
#### fn
Type: `Function`<br>
The function to add to the queue.
#### isHigh
Type: `Boolean`<br>
Default: `false`<br>
If the `fn` should be added to the "high priority" queue.
> **Important:** Only available in "priority" mode!
### isDone
Type: `Function`<br>
Returns: `void`
Signifies that a function has been completed.
> **Important:** Failure to call this will prevent `throttles` from continuing to the next item!
## License
MIT © [Luke Edwards](https://lukeed.com)