@withjoy/limiter 0.1.4-test → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,74 +0,0 @@
1
- {
2
- "_args": [
3
- [
4
- "lru-cache@4.1.5",
5
- "/Users/mindpath/work/joy/limiter"
6
- ]
7
- ],
8
- "_from": "lru-cache@4.1.5",
9
- "_id": "lru-cache@4.1.5",
10
- "_inBundle": false,
11
- "_integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
12
- "_location": "/limitd-redis/lru-cache",
13
- "_phantomChildren": {},
14
- "_requested": {
15
- "type": "version",
16
- "registry": true,
17
- "raw": "lru-cache@4.1.5",
18
- "name": "lru-cache",
19
- "escapedName": "lru-cache",
20
- "rawSpec": "4.1.5",
21
- "saveSpec": null,
22
- "fetchSpec": "4.1.5"
23
- },
24
- "_requiredBy": [
25
- "/limitd-redis"
26
- ],
27
- "_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
28
- "_spec": "4.1.5",
29
- "_where": "/Users/mindpath/work/joy/limiter",
30
- "author": {
31
- "name": "Isaac Z. Schlueter",
32
- "email": "i@izs.me"
33
- },
34
- "bugs": {
35
- "url": "https://github.com/isaacs/node-lru-cache/issues"
36
- },
37
- "dependencies": {
38
- "pseudomap": "^1.0.2",
39
- "yallist": "^2.1.2"
40
- },
41
- "description": "A cache object that deletes the least-recently-used items.",
42
- "devDependencies": {
43
- "benchmark": "^2.1.4",
44
- "standard": "^12.0.1",
45
- "tap": "^12.1.0"
46
- },
47
- "files": [
48
- "index.js"
49
- ],
50
- "homepage": "https://github.com/isaacs/node-lru-cache#readme",
51
- "keywords": [
52
- "mru",
53
- "lru",
54
- "cache"
55
- ],
56
- "license": "ISC",
57
- "main": "index.js",
58
- "name": "lru-cache",
59
- "repository": {
60
- "type": "git",
61
- "url": "git://github.com/isaacs/node-lru-cache.git"
62
- },
63
- "scripts": {
64
- "coveragerport": "tap --coverage-report=html",
65
- "lintfix": "standard --fix test/*.js index.js",
66
- "postpublish": "git push origin --all; git push origin --tags",
67
- "posttest": "standard test/*.js index.js",
68
- "postversion": "npm publish --tag=legacy",
69
- "preversion": "npm test",
70
- "snap": "TAP_SNAPSHOT=1 tap test/*.js -J",
71
- "test": "tap test/*.js --100 -J"
72
- },
73
- "version": "4.1.5"
74
- }
@@ -1,162 +0,0 @@
1
- /**
2
- * Helpers.
3
- */
4
-
5
- var s = 1000;
6
- var m = s * 60;
7
- var h = m * 60;
8
- var d = h * 24;
9
- var w = d * 7;
10
- var y = d * 365.25;
11
-
12
- /**
13
- * Parse or format the given `val`.
14
- *
15
- * Options:
16
- *
17
- * - `long` verbose formatting [false]
18
- *
19
- * @param {String|Number} val
20
- * @param {Object} [options]
21
- * @throws {Error} throw an error if val is not a non-empty string or a number
22
- * @return {String|Number}
23
- * @api public
24
- */
25
-
26
- module.exports = function (val, options) {
27
- options = options || {};
28
- var type = typeof val;
29
- if (type === 'string' && val.length > 0) {
30
- return parse(val);
31
- } else if (type === 'number' && isFinite(val)) {
32
- return options.long ? fmtLong(val) : fmtShort(val);
33
- }
34
- throw new Error(
35
- 'val is not a non-empty string or a valid number. val=' +
36
- JSON.stringify(val)
37
- );
38
- };
39
-
40
- /**
41
- * Parse the given `str` and return milliseconds.
42
- *
43
- * @param {String} str
44
- * @return {Number}
45
- * @api private
46
- */
47
-
48
- function parse(str) {
49
- str = String(str);
50
- if (str.length > 100) {
51
- return;
52
- }
53
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
54
- str
55
- );
56
- if (!match) {
57
- return;
58
- }
59
- var n = parseFloat(match[1]);
60
- var type = (match[2] || 'ms').toLowerCase();
61
- switch (type) {
62
- case 'years':
63
- case 'year':
64
- case 'yrs':
65
- case 'yr':
66
- case 'y':
67
- return n * y;
68
- case 'weeks':
69
- case 'week':
70
- case 'w':
71
- return n * w;
72
- case 'days':
73
- case 'day':
74
- case 'd':
75
- return n * d;
76
- case 'hours':
77
- case 'hour':
78
- case 'hrs':
79
- case 'hr':
80
- case 'h':
81
- return n * h;
82
- case 'minutes':
83
- case 'minute':
84
- case 'mins':
85
- case 'min':
86
- case 'm':
87
- return n * m;
88
- case 'seconds':
89
- case 'second':
90
- case 'secs':
91
- case 'sec':
92
- case 's':
93
- return n * s;
94
- case 'milliseconds':
95
- case 'millisecond':
96
- case 'msecs':
97
- case 'msec':
98
- case 'ms':
99
- return n;
100
- default:
101
- return undefined;
102
- }
103
- }
104
-
105
- /**
106
- * Short format for `ms`.
107
- *
108
- * @param {Number} ms
109
- * @return {String}
110
- * @api private
111
- */
112
-
113
- function fmtShort(ms) {
114
- var msAbs = Math.abs(ms);
115
- if (msAbs >= d) {
116
- return Math.round(ms / d) + 'd';
117
- }
118
- if (msAbs >= h) {
119
- return Math.round(ms / h) + 'h';
120
- }
121
- if (msAbs >= m) {
122
- return Math.round(ms / m) + 'm';
123
- }
124
- if (msAbs >= s) {
125
- return Math.round(ms / s) + 's';
126
- }
127
- return ms + 'ms';
128
- }
129
-
130
- /**
131
- * Long format for `ms`.
132
- *
133
- * @param {Number} ms
134
- * @return {String}
135
- * @api private
136
- */
137
-
138
- function fmtLong(ms) {
139
- var msAbs = Math.abs(ms);
140
- if (msAbs >= d) {
141
- return plural(ms, msAbs, d, 'day');
142
- }
143
- if (msAbs >= h) {
144
- return plural(ms, msAbs, h, 'hour');
145
- }
146
- if (msAbs >= m) {
147
- return plural(ms, msAbs, m, 'minute');
148
- }
149
- if (msAbs >= s) {
150
- return plural(ms, msAbs, s, 'second');
151
- }
152
- return ms + ' ms';
153
- }
154
-
155
- /**
156
- * Pluralization helper.
157
- */
158
-
159
- function plural(ms, msAbs, n, name) {
160
- var isPlural = msAbs >= n * 1.5;
161
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
162
- }
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 Vercel, Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,73 +0,0 @@
1
- {
2
- "_args": [
3
- [
4
- "ms@2.1.3",
5
- "/Users/mindpath/work/joy/limiter"
6
- ]
7
- ],
8
- "_from": "ms@2.1.3",
9
- "_id": "ms@2.1.3",
10
- "_inBundle": false,
11
- "_integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
12
- "_location": "/limitd-redis/ms",
13
- "_phantomChildren": {},
14
- "_requested": {
15
- "type": "version",
16
- "registry": true,
17
- "raw": "ms@2.1.3",
18
- "name": "ms",
19
- "escapedName": "ms",
20
- "rawSpec": "2.1.3",
21
- "saveSpec": null,
22
- "fetchSpec": "2.1.3"
23
- },
24
- "_requiredBy": [
25
- "/limitd-redis"
26
- ],
27
- "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
28
- "_spec": "2.1.3",
29
- "_where": "/Users/mindpath/work/joy/limiter",
30
- "bugs": {
31
- "url": "https://github.com/vercel/ms/issues"
32
- },
33
- "description": "Tiny millisecond conversion utility",
34
- "devDependencies": {
35
- "eslint": "4.18.2",
36
- "expect.js": "0.3.1",
37
- "husky": "0.14.3",
38
- "lint-staged": "5.0.0",
39
- "mocha": "4.0.1",
40
- "prettier": "2.0.5"
41
- },
42
- "eslintConfig": {
43
- "extends": "eslint:recommended",
44
- "env": {
45
- "node": true,
46
- "es6": true
47
- }
48
- },
49
- "files": [
50
- "index.js"
51
- ],
52
- "homepage": "https://github.com/vercel/ms#readme",
53
- "license": "MIT",
54
- "lint-staged": {
55
- "*.js": [
56
- "npm run lint",
57
- "prettier --single-quote --write",
58
- "git add"
59
- ]
60
- },
61
- "main": "./index",
62
- "name": "ms",
63
- "repository": {
64
- "type": "git",
65
- "url": "git+https://github.com/vercel/ms.git"
66
- },
67
- "scripts": {
68
- "lint": "eslint lib/* bin/*",
69
- "precommit": "lint-staged",
70
- "test": "mocha tests.js"
71
- },
72
- "version": "2.1.3"
73
- }
@@ -1,59 +0,0 @@
1
- # ms
2
-
3
- ![CI](https://github.com/vercel/ms/workflows/CI/badge.svg)
4
-
5
- Use this package to easily convert various time formats to milliseconds.
6
-
7
- ## Examples
8
-
9
- ```js
10
- ms('2 days') // 172800000
11
- ms('1d') // 86400000
12
- ms('10h') // 36000000
13
- ms('2.5 hrs') // 9000000
14
- ms('2h') // 7200000
15
- ms('1m') // 60000
16
- ms('5s') // 5000
17
- ms('1y') // 31557600000
18
- ms('100') // 100
19
- ms('-3 days') // -259200000
20
- ms('-1h') // -3600000
21
- ms('-200') // -200
22
- ```
23
-
24
- ### Convert from Milliseconds
25
-
26
- ```js
27
- ms(60000) // "1m"
28
- ms(2 * 60000) // "2m"
29
- ms(-3 * 60000) // "-3m"
30
- ms(ms('10 hours')) // "10h"
31
- ```
32
-
33
- ### Time Format Written-Out
34
-
35
- ```js
36
- ms(60000, { long: true }) // "1 minute"
37
- ms(2 * 60000, { long: true }) // "2 minutes"
38
- ms(-3 * 60000, { long: true }) // "-3 minutes"
39
- ms(ms('10 hours'), { long: true }) // "10 hours"
40
- ```
41
-
42
- ## Features
43
-
44
- - Works both in [Node.js](https://nodejs.org) and in the browser
45
- - If a number is supplied to `ms`, a string with a unit is returned
46
- - If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
47
- - If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
48
-
49
- ## Related Packages
50
-
51
- - [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
52
-
53
- ## Caught a Bug?
54
-
55
- 1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
56
- 2. Link the package to the global module directory: `npm link`
57
- 3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
58
-
59
- As always, you can run the tests using: `npm test`
@@ -1,15 +0,0 @@
1
- The ISC License
2
-
3
- Copyright (c) Isaac Z. Schlueter and Contributors
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted, provided that the above
7
- copyright notice and this permission notice appear in all copies.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15
- IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -1,204 +0,0 @@
1
- # yallist
2
-
3
- Yet Another Linked List
4
-
5
- There are many doubly-linked list implementations like it, but this
6
- one is mine.
7
-
8
- For when an array would be too big, and a Map can't be iterated in
9
- reverse order.
10
-
11
-
12
- [![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist)
13
-
14
- ## basic usage
15
-
16
- ```javascript
17
- var yallist = require('yallist')
18
- var myList = yallist.create([1, 2, 3])
19
- myList.push('foo')
20
- myList.unshift('bar')
21
- // of course pop() and shift() are there, too
22
- console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo']
23
- myList.forEach(function (k) {
24
- // walk the list head to tail
25
- })
26
- myList.forEachReverse(function (k, index, list) {
27
- // walk the list tail to head
28
- })
29
- var myDoubledList = myList.map(function (k) {
30
- return k + k
31
- })
32
- // now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo']
33
- // mapReverse is also a thing
34
- var myDoubledListReverse = myList.mapReverse(function (k) {
35
- return k + k
36
- }) // ['foofoo', 6, 4, 2, 'barbar']
37
-
38
- var reduced = myList.reduce(function (set, entry) {
39
- set += entry
40
- return set
41
- }, 'start')
42
- console.log(reduced) // 'startfoo123bar'
43
- ```
44
-
45
- ## api
46
-
47
- The whole API is considered "public".
48
-
49
- Functions with the same name as an Array method work more or less the
50
- same way.
51
-
52
- There's reverse versions of most things because that's the point.
53
-
54
- ### Yallist
55
-
56
- Default export, the class that holds and manages a list.
57
-
58
- Call it with either a forEach-able (like an array) or a set of
59
- arguments, to initialize the list.
60
-
61
- The Array-ish methods all act like you'd expect. No magic length,
62
- though, so if you change that it won't automatically prune or add
63
- empty spots.
64
-
65
- ### Yallist.create(..)
66
-
67
- Alias for Yallist function. Some people like factories.
68
-
69
- #### yallist.head
70
-
71
- The first node in the list
72
-
73
- #### yallist.tail
74
-
75
- The last node in the list
76
-
77
- #### yallist.length
78
-
79
- The number of nodes in the list. (Change this at your peril. It is
80
- not magic like Array length.)
81
-
82
- #### yallist.toArray()
83
-
84
- Convert the list to an array.
85
-
86
- #### yallist.forEach(fn, [thisp])
87
-
88
- Call a function on each item in the list.
89
-
90
- #### yallist.forEachReverse(fn, [thisp])
91
-
92
- Call a function on each item in the list, in reverse order.
93
-
94
- #### yallist.get(n)
95
-
96
- Get the data at position `n` in the list. If you use this a lot,
97
- probably better off just using an Array.
98
-
99
- #### yallist.getReverse(n)
100
-
101
- Get the data at position `n`, counting from the tail.
102
-
103
- #### yallist.map(fn, thisp)
104
-
105
- Create a new Yallist with the result of calling the function on each
106
- item.
107
-
108
- #### yallist.mapReverse(fn, thisp)
109
-
110
- Same as `map`, but in reverse.
111
-
112
- #### yallist.pop()
113
-
114
- Get the data from the list tail, and remove the tail from the list.
115
-
116
- #### yallist.push(item, ...)
117
-
118
- Insert one or more items to the tail of the list.
119
-
120
- #### yallist.reduce(fn, initialValue)
121
-
122
- Like Array.reduce.
123
-
124
- #### yallist.reduceReverse
125
-
126
- Like Array.reduce, but in reverse.
127
-
128
- #### yallist.reverse
129
-
130
- Reverse the list in place.
131
-
132
- #### yallist.shift()
133
-
134
- Get the data from the list head, and remove the head from the list.
135
-
136
- #### yallist.slice([from], [to])
137
-
138
- Just like Array.slice, but returns a new Yallist.
139
-
140
- #### yallist.sliceReverse([from], [to])
141
-
142
- Just like yallist.slice, but the result is returned in reverse.
143
-
144
- #### yallist.toArray()
145
-
146
- Create an array representation of the list.
147
-
148
- #### yallist.toArrayReverse()
149
-
150
- Create a reversed array representation of the list.
151
-
152
- #### yallist.unshift(item, ...)
153
-
154
- Insert one or more items to the head of the list.
155
-
156
- #### yallist.unshiftNode(node)
157
-
158
- Move a Node object to the front of the list. (That is, pull it out of
159
- wherever it lives, and make it the new head.)
160
-
161
- If the node belongs to a different list, then that list will remove it
162
- first.
163
-
164
- #### yallist.pushNode(node)
165
-
166
- Move a Node object to the end of the list. (That is, pull it out of
167
- wherever it lives, and make it the new tail.)
168
-
169
- If the node belongs to a list already, then that list will remove it
170
- first.
171
-
172
- #### yallist.removeNode(node)
173
-
174
- Remove a node from the list, preserving referential integrity of head
175
- and tail and other nodes.
176
-
177
- Will throw an error if you try to have a list remove a node that
178
- doesn't belong to it.
179
-
180
- ### Yallist.Node
181
-
182
- The class that holds the data and is actually the list.
183
-
184
- Call with `var n = new Node(value, previousNode, nextNode)`
185
-
186
- Note that if you do direct operations on Nodes themselves, it's very
187
- easy to get into weird states where the list is broken. Be careful :)
188
-
189
- #### node.next
190
-
191
- The next node in the list.
192
-
193
- #### node.prev
194
-
195
- The previous node in the list.
196
-
197
- #### node.value
198
-
199
- The data the node contains.
200
-
201
- #### node.list
202
-
203
- The list to which this node belongs. (Null if it does not belong to
204
- any list.)
@@ -1,7 +0,0 @@
1
- var Yallist = require('./yallist.js')
2
-
3
- Yallist.prototype[Symbol.iterator] = function* () {
4
- for (let walker = this.head; walker; walker = walker.next) {
5
- yield walker.value
6
- }
7
- }
@@ -1,65 +0,0 @@
1
- {
2
- "_args": [
3
- [
4
- "yallist@2.1.2",
5
- "/Users/mindpath/work/joy/limiter"
6
- ]
7
- ],
8
- "_from": "yallist@2.1.2",
9
- "_id": "yallist@2.1.2",
10
- "_inBundle": false,
11
- "_integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==",
12
- "_location": "/limitd-redis/yallist",
13
- "_phantomChildren": {},
14
- "_requested": {
15
- "type": "version",
16
- "registry": true,
17
- "raw": "yallist@2.1.2",
18
- "name": "yallist",
19
- "escapedName": "yallist",
20
- "rawSpec": "2.1.2",
21
- "saveSpec": null,
22
- "fetchSpec": "2.1.2"
23
- },
24
- "_requiredBy": [
25
- "/limitd-redis/lru-cache"
26
- ],
27
- "_resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
28
- "_spec": "2.1.2",
29
- "_where": "/Users/mindpath/work/joy/limiter",
30
- "author": {
31
- "name": "Isaac Z. Schlueter",
32
- "email": "i@izs.me",
33
- "url": "http://blog.izs.me/"
34
- },
35
- "bugs": {
36
- "url": "https://github.com/isaacs/yallist/issues"
37
- },
38
- "dependencies": {},
39
- "description": "Yet Another Linked List",
40
- "devDependencies": {
41
- "tap": "^10.3.0"
42
- },
43
- "directories": {
44
- "test": "test"
45
- },
46
- "files": [
47
- "yallist.js",
48
- "iterator.js"
49
- ],
50
- "homepage": "https://github.com/isaacs/yallist#readme",
51
- "license": "ISC",
52
- "main": "yallist.js",
53
- "name": "yallist",
54
- "repository": {
55
- "type": "git",
56
- "url": "git+https://github.com/isaacs/yallist.git"
57
- },
58
- "scripts": {
59
- "postpublish": "git push origin --all; git push origin --tags",
60
- "postversion": "npm publish",
61
- "preversion": "npm test",
62
- "test": "tap test/*.js --100"
63
- },
64
- "version": "2.1.2"
65
- }