deployable-awscdk-app-ts 0.1.315 → 0.1.316
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.
- package/.jsii +2 -2
- package/lib/index.js +1 -1
- package/node_modules/semver/bin/semver.js +0 -0
- package/node_modules/semver/node_modules/lru-cache/LICENSE +15 -0
- package/node_modules/semver/node_modules/lru-cache/README.md +166 -0
- package/node_modules/semver/node_modules/lru-cache/index.js +334 -0
- package/node_modules/semver/node_modules/lru-cache/package.json +34 -0
- package/node_modules/semver/node_modules/yallist/LICENSE +15 -0
- package/node_modules/semver/node_modules/yallist/README.md +204 -0
- package/node_modules/semver/node_modules/yallist/iterator.js +8 -0
- package/node_modules/semver/node_modules/yallist/package.json +29 -0
- package/node_modules/semver/node_modules/yallist/yallist.js +426 -0
- package/package.json +29 -29
package/.jsii
CHANGED
package/lib/index.js
CHANGED
|
@@ -194,5 +194,5 @@ class DeployableAwsCdkTypeScriptApp extends projen_1.awscdk.AwsCdkTypeScriptApp
|
|
|
194
194
|
}
|
|
195
195
|
exports.DeployableAwsCdkTypeScriptApp = DeployableAwsCdkTypeScriptApp;
|
|
196
196
|
_a = JSII_RTTI_SYMBOL_1;
|
|
197
|
-
DeployableAwsCdkTypeScriptApp[_a] = { fqn: "deployable-awscdk-app-ts.DeployableAwsCdkTypeScriptApp", version: "0.1.
|
|
197
|
+
DeployableAwsCdkTypeScriptApp[_a] = { fqn: "deployable-awscdk-app-ts.DeployableAwsCdkTypeScriptApp", version: "0.1.316" };
|
|
198
198
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLG1DQUE2QztBQUM3Qyx1RUFBb0U7QUFDcEUsc0RBQWd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CguLi5zdGVwcy5zZXRBd3NDcmVkZW50aWFsc1N0ZXBzKHRoaXMuY2hlY2tBY3RpdmVEZXBsb3ltZW50LCB0aGlzLmNvZGVBcnRpZmFjdE9wdGlvbnM/LmF1dGhQcm92aWRlcikpXG5cbiAgICBpZiAodGhpcy5kZXBsb3lPcHRpb25zLm5wbUNvbmZpZ0Vudmlyb25tZW50KVxuICAgICAgam9iRGVmaW5pdGlvbi5zdGVwcy5wdXNoKHN0ZXBzLnNldE5wbUNvbmZpZyh0aGlzLmRlcGxveU9wdGlvbnMubnBtQ29uZmlnRW52aXJvbm1lbnQsICcke3sgbWF0cml4LmVudmlyb25tZW50IH19JywgdGhpcy5jaGVja0FjdGl2ZURlcGxveW1lbnQpKVxuXG4gICAgam9iRGVmaW5pdGlvbi5zdGVwcy5wdXNoKHN0ZXBzLnByZURlcGxveW1lbnRTdGVwKHRoaXMuY2hlY2tBY3RpdmVEZXBsb3ltZW50LCB0aGlzLnBhY2thZ2UucGFja2FnZU1hbmFnZXIpKVxuICAgIGpvYkRlZmluaXRpb24uc3RlcHMucHVzaChzdGVwcy5kZXBsb3ltZW50U3RlcCh0aGlzLmNoZWNrQWN0aXZlRGVwbG95bWVudCwgdGhpcy5wYWNrYWdlLnBhY2thZ2VNYW5hZ2VyKSlcbiAgICBqb2JEZWZpbml0aW9uLnN0ZXBzLnB1c2goc3RlcHMucG9zdERlcGxveW1lbnRTdGVwKHRoaXMuY2hlY2tBY3RpdmVEZXBsb3ltZW50LCB0aGlzLnBhY2thZ2UucGFja2FnZU1hbmFnZXIpKVxuXG4gICAgdGhpcy5yZWxlYXNlPy5hZGRKb2JzKHtkZXBsb3k6IGpvYkRlZmluaXRpb259KVxuXG4gIH1cbn0iXX0=
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
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.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# lru cache
|
|
2
|
+
|
|
3
|
+
A cache object that deletes the least-recently-used items.
|
|
4
|
+
|
|
5
|
+
[](https://travis-ci.org/isaacs/node-lru-cache) [](https://coveralls.io/github/isaacs/node-lru-cache)
|
|
6
|
+
|
|
7
|
+
## Installation:
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
npm install lru-cache --save
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage:
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
var LRU = require("lru-cache")
|
|
17
|
+
, options = { max: 500
|
|
18
|
+
, length: function (n, key) { return n * 2 + key.length }
|
|
19
|
+
, dispose: function (key, n) { n.close() }
|
|
20
|
+
, maxAge: 1000 * 60 * 60 }
|
|
21
|
+
, cache = new LRU(options)
|
|
22
|
+
, otherCache = new LRU(50) // sets just the max size
|
|
23
|
+
|
|
24
|
+
cache.set("key", "value")
|
|
25
|
+
cache.get("key") // "value"
|
|
26
|
+
|
|
27
|
+
// non-string keys ARE fully supported
|
|
28
|
+
// but note that it must be THE SAME object, not
|
|
29
|
+
// just a JSON-equivalent object.
|
|
30
|
+
var someObject = { a: 1 }
|
|
31
|
+
cache.set(someObject, 'a value')
|
|
32
|
+
// Object keys are not toString()-ed
|
|
33
|
+
cache.set('[object Object]', 'a different value')
|
|
34
|
+
assert.equal(cache.get(someObject), 'a value')
|
|
35
|
+
// A similar object with same keys/values won't work,
|
|
36
|
+
// because it's a different object identity
|
|
37
|
+
assert.equal(cache.get({ a: 1 }), undefined)
|
|
38
|
+
|
|
39
|
+
cache.reset() // empty the cache
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If you put more stuff in it, then items will fall out.
|
|
43
|
+
|
|
44
|
+
If you try to put an oversized thing in it, then it'll fall out right
|
|
45
|
+
away.
|
|
46
|
+
|
|
47
|
+
## Options
|
|
48
|
+
|
|
49
|
+
* `max` The maximum size of the cache, checked by applying the length
|
|
50
|
+
function to all values in the cache. Not setting this is kind of
|
|
51
|
+
silly, since that's the whole purpose of this lib, but it defaults
|
|
52
|
+
to `Infinity`. Setting it to a non-number or negative number will
|
|
53
|
+
throw a `TypeError`. Setting it to 0 makes it be `Infinity`.
|
|
54
|
+
* `maxAge` Maximum age in ms. Items are not pro-actively pruned out
|
|
55
|
+
as they age, but if you try to get an item that is too old, it'll
|
|
56
|
+
drop it and return undefined instead of giving it to you.
|
|
57
|
+
Setting this to a negative value will make everything seem old!
|
|
58
|
+
Setting it to a non-number will throw a `TypeError`.
|
|
59
|
+
* `length` Function that is used to calculate the length of stored
|
|
60
|
+
items. If you're storing strings or buffers, then you probably want
|
|
61
|
+
to do something like `function(n, key){return n.length}`. The default is
|
|
62
|
+
`function(){return 1}`, which is fine if you want to store `max`
|
|
63
|
+
like-sized things. The item is passed as the first argument, and
|
|
64
|
+
the key is passed as the second argumnet.
|
|
65
|
+
* `dispose` Function that is called on items when they are dropped
|
|
66
|
+
from the cache. This can be handy if you want to close file
|
|
67
|
+
descriptors or do other cleanup tasks when items are no longer
|
|
68
|
+
accessible. Called with `key, value`. It's called *before*
|
|
69
|
+
actually removing the item from the internal cache, so if you want
|
|
70
|
+
to immediately put it back in, you'll have to do that in a
|
|
71
|
+
`nextTick` or `setTimeout` callback or it won't do anything.
|
|
72
|
+
* `stale` By default, if you set a `maxAge`, it'll only actually pull
|
|
73
|
+
stale items out of the cache when you `get(key)`. (That is, it's
|
|
74
|
+
not pre-emptively doing a `setTimeout` or anything.) If you set
|
|
75
|
+
`stale:true`, it'll return the stale value before deleting it. If
|
|
76
|
+
you don't set this, then it'll return `undefined` when you try to
|
|
77
|
+
get a stale entry, as if it had already been deleted.
|
|
78
|
+
* `noDisposeOnSet` By default, if you set a `dispose()` method, then
|
|
79
|
+
it'll be called whenever a `set()` operation overwrites an existing
|
|
80
|
+
key. If you set this option, `dispose()` will only be called when a
|
|
81
|
+
key falls out of the cache, not when it is overwritten.
|
|
82
|
+
* `updateAgeOnGet` When using time-expiring entries with `maxAge`,
|
|
83
|
+
setting this to `true` will make each item's effective time update
|
|
84
|
+
to the current time whenever it is retrieved from cache, causing it
|
|
85
|
+
to not expire. (It can still fall out of cache based on recency of
|
|
86
|
+
use, of course.)
|
|
87
|
+
|
|
88
|
+
## API
|
|
89
|
+
|
|
90
|
+
* `set(key, value, maxAge)`
|
|
91
|
+
* `get(key) => value`
|
|
92
|
+
|
|
93
|
+
Both of these will update the "recently used"-ness of the key.
|
|
94
|
+
They do what you think. `maxAge` is optional and overrides the
|
|
95
|
+
cache `maxAge` option if provided.
|
|
96
|
+
|
|
97
|
+
If the key is not found, `get()` will return `undefined`.
|
|
98
|
+
|
|
99
|
+
The key and val can be any value.
|
|
100
|
+
|
|
101
|
+
* `peek(key)`
|
|
102
|
+
|
|
103
|
+
Returns the key value (or `undefined` if not found) without
|
|
104
|
+
updating the "recently used"-ness of the key.
|
|
105
|
+
|
|
106
|
+
(If you find yourself using this a lot, you *might* be using the
|
|
107
|
+
wrong sort of data structure, but there are some use cases where
|
|
108
|
+
it's handy.)
|
|
109
|
+
|
|
110
|
+
* `del(key)`
|
|
111
|
+
|
|
112
|
+
Deletes a key out of the cache.
|
|
113
|
+
|
|
114
|
+
* `reset()`
|
|
115
|
+
|
|
116
|
+
Clear the cache entirely, throwing away all values.
|
|
117
|
+
|
|
118
|
+
* `has(key)`
|
|
119
|
+
|
|
120
|
+
Check if a key is in the cache, without updating the recent-ness
|
|
121
|
+
or deleting it for being stale.
|
|
122
|
+
|
|
123
|
+
* `forEach(function(value,key,cache), [thisp])`
|
|
124
|
+
|
|
125
|
+
Just like `Array.prototype.forEach`. Iterates over all the keys
|
|
126
|
+
in the cache, in order of recent-ness. (Ie, more recently used
|
|
127
|
+
items are iterated over first.)
|
|
128
|
+
|
|
129
|
+
* `rforEach(function(value,key,cache), [thisp])`
|
|
130
|
+
|
|
131
|
+
The same as `cache.forEach(...)` but items are iterated over in
|
|
132
|
+
reverse order. (ie, less recently used items are iterated over
|
|
133
|
+
first.)
|
|
134
|
+
|
|
135
|
+
* `keys()`
|
|
136
|
+
|
|
137
|
+
Return an array of the keys in the cache.
|
|
138
|
+
|
|
139
|
+
* `values()`
|
|
140
|
+
|
|
141
|
+
Return an array of the values in the cache.
|
|
142
|
+
|
|
143
|
+
* `length`
|
|
144
|
+
|
|
145
|
+
Return total length of objects in cache taking into account
|
|
146
|
+
`length` options function.
|
|
147
|
+
|
|
148
|
+
* `itemCount`
|
|
149
|
+
|
|
150
|
+
Return total quantity of objects currently in cache. Note, that
|
|
151
|
+
`stale` (see options) items are returned as part of this item
|
|
152
|
+
count.
|
|
153
|
+
|
|
154
|
+
* `dump()`
|
|
155
|
+
|
|
156
|
+
Return an array of the cache entries ready for serialization and usage
|
|
157
|
+
with 'destinationCache.load(arr)`.
|
|
158
|
+
|
|
159
|
+
* `load(cacheEntriesArray)`
|
|
160
|
+
|
|
161
|
+
Loads another cache entries array, obtained with `sourceCache.dump()`,
|
|
162
|
+
into the cache. The destination cache is reset before loading new entries
|
|
163
|
+
|
|
164
|
+
* `prune()`
|
|
165
|
+
|
|
166
|
+
Manually iterates over the entire cache proactively pruning old entries
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// A linked list to keep track of recently-used-ness
|
|
4
|
+
const Yallist = require('yallist')
|
|
5
|
+
|
|
6
|
+
const MAX = Symbol('max')
|
|
7
|
+
const LENGTH = Symbol('length')
|
|
8
|
+
const LENGTH_CALCULATOR = Symbol('lengthCalculator')
|
|
9
|
+
const ALLOW_STALE = Symbol('allowStale')
|
|
10
|
+
const MAX_AGE = Symbol('maxAge')
|
|
11
|
+
const DISPOSE = Symbol('dispose')
|
|
12
|
+
const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
|
|
13
|
+
const LRU_LIST = Symbol('lruList')
|
|
14
|
+
const CACHE = Symbol('cache')
|
|
15
|
+
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
|
|
16
|
+
|
|
17
|
+
const naiveLength = () => 1
|
|
18
|
+
|
|
19
|
+
// lruList is a yallist where the head is the youngest
|
|
20
|
+
// item, and the tail is the oldest. the list contains the Hit
|
|
21
|
+
// objects as the entries.
|
|
22
|
+
// Each Hit object has a reference to its Yallist.Node. This
|
|
23
|
+
// never changes.
|
|
24
|
+
//
|
|
25
|
+
// cache is a Map (or PseudoMap) that matches the keys to
|
|
26
|
+
// the Yallist.Node object.
|
|
27
|
+
class LRUCache {
|
|
28
|
+
constructor (options) {
|
|
29
|
+
if (typeof options === 'number')
|
|
30
|
+
options = { max: options }
|
|
31
|
+
|
|
32
|
+
if (!options)
|
|
33
|
+
options = {}
|
|
34
|
+
|
|
35
|
+
if (options.max && (typeof options.max !== 'number' || options.max < 0))
|
|
36
|
+
throw new TypeError('max must be a non-negative number')
|
|
37
|
+
// Kind of weird to have a default max of Infinity, but oh well.
|
|
38
|
+
const max = this[MAX] = options.max || Infinity
|
|
39
|
+
|
|
40
|
+
const lc = options.length || naiveLength
|
|
41
|
+
this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
|
|
42
|
+
this[ALLOW_STALE] = options.stale || false
|
|
43
|
+
if (options.maxAge && typeof options.maxAge !== 'number')
|
|
44
|
+
throw new TypeError('maxAge must be a number')
|
|
45
|
+
this[MAX_AGE] = options.maxAge || 0
|
|
46
|
+
this[DISPOSE] = options.dispose
|
|
47
|
+
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
|
|
48
|
+
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
|
|
49
|
+
this.reset()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// resize the cache when the max changes.
|
|
53
|
+
set max (mL) {
|
|
54
|
+
if (typeof mL !== 'number' || mL < 0)
|
|
55
|
+
throw new TypeError('max must be a non-negative number')
|
|
56
|
+
|
|
57
|
+
this[MAX] = mL || Infinity
|
|
58
|
+
trim(this)
|
|
59
|
+
}
|
|
60
|
+
get max () {
|
|
61
|
+
return this[MAX]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
set allowStale (allowStale) {
|
|
65
|
+
this[ALLOW_STALE] = !!allowStale
|
|
66
|
+
}
|
|
67
|
+
get allowStale () {
|
|
68
|
+
return this[ALLOW_STALE]
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
set maxAge (mA) {
|
|
72
|
+
if (typeof mA !== 'number')
|
|
73
|
+
throw new TypeError('maxAge must be a non-negative number')
|
|
74
|
+
|
|
75
|
+
this[MAX_AGE] = mA
|
|
76
|
+
trim(this)
|
|
77
|
+
}
|
|
78
|
+
get maxAge () {
|
|
79
|
+
return this[MAX_AGE]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// resize the cache when the lengthCalculator changes.
|
|
83
|
+
set lengthCalculator (lC) {
|
|
84
|
+
if (typeof lC !== 'function')
|
|
85
|
+
lC = naiveLength
|
|
86
|
+
|
|
87
|
+
if (lC !== this[LENGTH_CALCULATOR]) {
|
|
88
|
+
this[LENGTH_CALCULATOR] = lC
|
|
89
|
+
this[LENGTH] = 0
|
|
90
|
+
this[LRU_LIST].forEach(hit => {
|
|
91
|
+
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
|
|
92
|
+
this[LENGTH] += hit.length
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
trim(this)
|
|
96
|
+
}
|
|
97
|
+
get lengthCalculator () { return this[LENGTH_CALCULATOR] }
|
|
98
|
+
|
|
99
|
+
get length () { return this[LENGTH] }
|
|
100
|
+
get itemCount () { return this[LRU_LIST].length }
|
|
101
|
+
|
|
102
|
+
rforEach (fn, thisp) {
|
|
103
|
+
thisp = thisp || this
|
|
104
|
+
for (let walker = this[LRU_LIST].tail; walker !== null;) {
|
|
105
|
+
const prev = walker.prev
|
|
106
|
+
forEachStep(this, fn, walker, thisp)
|
|
107
|
+
walker = prev
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
forEach (fn, thisp) {
|
|
112
|
+
thisp = thisp || this
|
|
113
|
+
for (let walker = this[LRU_LIST].head; walker !== null;) {
|
|
114
|
+
const next = walker.next
|
|
115
|
+
forEachStep(this, fn, walker, thisp)
|
|
116
|
+
walker = next
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
keys () {
|
|
121
|
+
return this[LRU_LIST].toArray().map(k => k.key)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
values () {
|
|
125
|
+
return this[LRU_LIST].toArray().map(k => k.value)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
reset () {
|
|
129
|
+
if (this[DISPOSE] &&
|
|
130
|
+
this[LRU_LIST] &&
|
|
131
|
+
this[LRU_LIST].length) {
|
|
132
|
+
this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
this[CACHE] = new Map() // hash of items by key
|
|
136
|
+
this[LRU_LIST] = new Yallist() // list of items in order of use recency
|
|
137
|
+
this[LENGTH] = 0 // length of items in the list
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
dump () {
|
|
141
|
+
return this[LRU_LIST].map(hit =>
|
|
142
|
+
isStale(this, hit) ? false : {
|
|
143
|
+
k: hit.key,
|
|
144
|
+
v: hit.value,
|
|
145
|
+
e: hit.now + (hit.maxAge || 0)
|
|
146
|
+
}).toArray().filter(h => h)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
dumpLru () {
|
|
150
|
+
return this[LRU_LIST]
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
set (key, value, maxAge) {
|
|
154
|
+
maxAge = maxAge || this[MAX_AGE]
|
|
155
|
+
|
|
156
|
+
if (maxAge && typeof maxAge !== 'number')
|
|
157
|
+
throw new TypeError('maxAge must be a number')
|
|
158
|
+
|
|
159
|
+
const now = maxAge ? Date.now() : 0
|
|
160
|
+
const len = this[LENGTH_CALCULATOR](value, key)
|
|
161
|
+
|
|
162
|
+
if (this[CACHE].has(key)) {
|
|
163
|
+
if (len > this[MAX]) {
|
|
164
|
+
del(this, this[CACHE].get(key))
|
|
165
|
+
return false
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const node = this[CACHE].get(key)
|
|
169
|
+
const item = node.value
|
|
170
|
+
|
|
171
|
+
// dispose of the old one before overwriting
|
|
172
|
+
// split out into 2 ifs for better coverage tracking
|
|
173
|
+
if (this[DISPOSE]) {
|
|
174
|
+
if (!this[NO_DISPOSE_ON_SET])
|
|
175
|
+
this[DISPOSE](key, item.value)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
item.now = now
|
|
179
|
+
item.maxAge = maxAge
|
|
180
|
+
item.value = value
|
|
181
|
+
this[LENGTH] += len - item.length
|
|
182
|
+
item.length = len
|
|
183
|
+
this.get(key)
|
|
184
|
+
trim(this)
|
|
185
|
+
return true
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const hit = new Entry(key, value, len, now, maxAge)
|
|
189
|
+
|
|
190
|
+
// oversized objects fall out of cache automatically.
|
|
191
|
+
if (hit.length > this[MAX]) {
|
|
192
|
+
if (this[DISPOSE])
|
|
193
|
+
this[DISPOSE](key, value)
|
|
194
|
+
|
|
195
|
+
return false
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
this[LENGTH] += hit.length
|
|
199
|
+
this[LRU_LIST].unshift(hit)
|
|
200
|
+
this[CACHE].set(key, this[LRU_LIST].head)
|
|
201
|
+
trim(this)
|
|
202
|
+
return true
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
has (key) {
|
|
206
|
+
if (!this[CACHE].has(key)) return false
|
|
207
|
+
const hit = this[CACHE].get(key).value
|
|
208
|
+
return !isStale(this, hit)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
get (key) {
|
|
212
|
+
return get(this, key, true)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
peek (key) {
|
|
216
|
+
return get(this, key, false)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
pop () {
|
|
220
|
+
const node = this[LRU_LIST].tail
|
|
221
|
+
if (!node)
|
|
222
|
+
return null
|
|
223
|
+
|
|
224
|
+
del(this, node)
|
|
225
|
+
return node.value
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
del (key) {
|
|
229
|
+
del(this, this[CACHE].get(key))
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
load (arr) {
|
|
233
|
+
// reset the cache
|
|
234
|
+
this.reset()
|
|
235
|
+
|
|
236
|
+
const now = Date.now()
|
|
237
|
+
// A previous serialized cache has the most recent items first
|
|
238
|
+
for (let l = arr.length - 1; l >= 0; l--) {
|
|
239
|
+
const hit = arr[l]
|
|
240
|
+
const expiresAt = hit.e || 0
|
|
241
|
+
if (expiresAt === 0)
|
|
242
|
+
// the item was created without expiration in a non aged cache
|
|
243
|
+
this.set(hit.k, hit.v)
|
|
244
|
+
else {
|
|
245
|
+
const maxAge = expiresAt - now
|
|
246
|
+
// dont add already expired items
|
|
247
|
+
if (maxAge > 0) {
|
|
248
|
+
this.set(hit.k, hit.v, maxAge)
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
prune () {
|
|
255
|
+
this[CACHE].forEach((value, key) => get(this, key, false))
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const get = (self, key, doUse) => {
|
|
260
|
+
const node = self[CACHE].get(key)
|
|
261
|
+
if (node) {
|
|
262
|
+
const hit = node.value
|
|
263
|
+
if (isStale(self, hit)) {
|
|
264
|
+
del(self, node)
|
|
265
|
+
if (!self[ALLOW_STALE])
|
|
266
|
+
return undefined
|
|
267
|
+
} else {
|
|
268
|
+
if (doUse) {
|
|
269
|
+
if (self[UPDATE_AGE_ON_GET])
|
|
270
|
+
node.value.now = Date.now()
|
|
271
|
+
self[LRU_LIST].unshiftNode(node)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return hit.value
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const isStale = (self, hit) => {
|
|
279
|
+
if (!hit || (!hit.maxAge && !self[MAX_AGE]))
|
|
280
|
+
return false
|
|
281
|
+
|
|
282
|
+
const diff = Date.now() - hit.now
|
|
283
|
+
return hit.maxAge ? diff > hit.maxAge
|
|
284
|
+
: self[MAX_AGE] && (diff > self[MAX_AGE])
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const trim = self => {
|
|
288
|
+
if (self[LENGTH] > self[MAX]) {
|
|
289
|
+
for (let walker = self[LRU_LIST].tail;
|
|
290
|
+
self[LENGTH] > self[MAX] && walker !== null;) {
|
|
291
|
+
// We know that we're about to delete this one, and also
|
|
292
|
+
// what the next least recently used key will be, so just
|
|
293
|
+
// go ahead and set it now.
|
|
294
|
+
const prev = walker.prev
|
|
295
|
+
del(self, walker)
|
|
296
|
+
walker = prev
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const del = (self, node) => {
|
|
302
|
+
if (node) {
|
|
303
|
+
const hit = node.value
|
|
304
|
+
if (self[DISPOSE])
|
|
305
|
+
self[DISPOSE](hit.key, hit.value)
|
|
306
|
+
|
|
307
|
+
self[LENGTH] -= hit.length
|
|
308
|
+
self[CACHE].delete(hit.key)
|
|
309
|
+
self[LRU_LIST].removeNode(node)
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
class Entry {
|
|
314
|
+
constructor (key, value, length, now, maxAge) {
|
|
315
|
+
this.key = key
|
|
316
|
+
this.value = value
|
|
317
|
+
this.length = length
|
|
318
|
+
this.now = now
|
|
319
|
+
this.maxAge = maxAge || 0
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const forEachStep = (self, fn, node, thisp) => {
|
|
324
|
+
let hit = node.value
|
|
325
|
+
if (isStale(self, hit)) {
|
|
326
|
+
del(self, node)
|
|
327
|
+
if (!self[ALLOW_STALE])
|
|
328
|
+
hit = undefined
|
|
329
|
+
}
|
|
330
|
+
if (hit)
|
|
331
|
+
fn.call(thisp, hit.value, hit.key, self)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
module.exports = LRUCache
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lru-cache",
|
|
3
|
+
"description": "A cache object that deletes the least-recently-used items.",
|
|
4
|
+
"version": "6.0.0",
|
|
5
|
+
"author": "Isaac Z. Schlueter <i@izs.me>",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"mru",
|
|
8
|
+
"lru",
|
|
9
|
+
"cache"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "tap",
|
|
13
|
+
"snap": "tap",
|
|
14
|
+
"preversion": "npm test",
|
|
15
|
+
"postversion": "npm publish",
|
|
16
|
+
"prepublishOnly": "git push origin --follow-tags"
|
|
17
|
+
},
|
|
18
|
+
"main": "index.js",
|
|
19
|
+
"repository": "git://github.com/isaacs/node-lru-cache.git",
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"benchmark": "^2.1.4",
|
|
22
|
+
"tap": "^14.10.7"
|
|
23
|
+
},
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"yallist": "^4.0.0"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"index.js"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=10"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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.
|
|
@@ -0,0 +1,204 @@
|
|
|
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
|
+
[](https://travis-ci.org/isaacs/yallist) [](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.)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "yallist",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Yet Another Linked List",
|
|
5
|
+
"main": "yallist.js",
|
|
6
|
+
"directories": {
|
|
7
|
+
"test": "test"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"yallist.js",
|
|
11
|
+
"iterator.js"
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"tap": "^12.1.0"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "tap test/*.js --100",
|
|
19
|
+
"preversion": "npm test",
|
|
20
|
+
"postversion": "npm publish",
|
|
21
|
+
"postpublish": "git push origin --all; git push origin --tags"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/isaacs/yallist.git"
|
|
26
|
+
},
|
|
27
|
+
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
28
|
+
"license": "ISC"
|
|
29
|
+
}
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
module.exports = Yallist
|
|
3
|
+
|
|
4
|
+
Yallist.Node = Node
|
|
5
|
+
Yallist.create = Yallist
|
|
6
|
+
|
|
7
|
+
function Yallist (list) {
|
|
8
|
+
var self = this
|
|
9
|
+
if (!(self instanceof Yallist)) {
|
|
10
|
+
self = new Yallist()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
self.tail = null
|
|
14
|
+
self.head = null
|
|
15
|
+
self.length = 0
|
|
16
|
+
|
|
17
|
+
if (list && typeof list.forEach === 'function') {
|
|
18
|
+
list.forEach(function (item) {
|
|
19
|
+
self.push(item)
|
|
20
|
+
})
|
|
21
|
+
} else if (arguments.length > 0) {
|
|
22
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
23
|
+
self.push(arguments[i])
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return self
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Yallist.prototype.removeNode = function (node) {
|
|
31
|
+
if (node.list !== this) {
|
|
32
|
+
throw new Error('removing node which does not belong to this list')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var next = node.next
|
|
36
|
+
var prev = node.prev
|
|
37
|
+
|
|
38
|
+
if (next) {
|
|
39
|
+
next.prev = prev
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (prev) {
|
|
43
|
+
prev.next = next
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (node === this.head) {
|
|
47
|
+
this.head = next
|
|
48
|
+
}
|
|
49
|
+
if (node === this.tail) {
|
|
50
|
+
this.tail = prev
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
node.list.length--
|
|
54
|
+
node.next = null
|
|
55
|
+
node.prev = null
|
|
56
|
+
node.list = null
|
|
57
|
+
|
|
58
|
+
return next
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Yallist.prototype.unshiftNode = function (node) {
|
|
62
|
+
if (node === this.head) {
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (node.list) {
|
|
67
|
+
node.list.removeNode(node)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var head = this.head
|
|
71
|
+
node.list = this
|
|
72
|
+
node.next = head
|
|
73
|
+
if (head) {
|
|
74
|
+
head.prev = node
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
this.head = node
|
|
78
|
+
if (!this.tail) {
|
|
79
|
+
this.tail = node
|
|
80
|
+
}
|
|
81
|
+
this.length++
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
Yallist.prototype.pushNode = function (node) {
|
|
85
|
+
if (node === this.tail) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (node.list) {
|
|
90
|
+
node.list.removeNode(node)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var tail = this.tail
|
|
94
|
+
node.list = this
|
|
95
|
+
node.prev = tail
|
|
96
|
+
if (tail) {
|
|
97
|
+
tail.next = node
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
this.tail = node
|
|
101
|
+
if (!this.head) {
|
|
102
|
+
this.head = node
|
|
103
|
+
}
|
|
104
|
+
this.length++
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
Yallist.prototype.push = function () {
|
|
108
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
109
|
+
push(this, arguments[i])
|
|
110
|
+
}
|
|
111
|
+
return this.length
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
Yallist.prototype.unshift = function () {
|
|
115
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
116
|
+
unshift(this, arguments[i])
|
|
117
|
+
}
|
|
118
|
+
return this.length
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Yallist.prototype.pop = function () {
|
|
122
|
+
if (!this.tail) {
|
|
123
|
+
return undefined
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var res = this.tail.value
|
|
127
|
+
this.tail = this.tail.prev
|
|
128
|
+
if (this.tail) {
|
|
129
|
+
this.tail.next = null
|
|
130
|
+
} else {
|
|
131
|
+
this.head = null
|
|
132
|
+
}
|
|
133
|
+
this.length--
|
|
134
|
+
return res
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
Yallist.prototype.shift = function () {
|
|
138
|
+
if (!this.head) {
|
|
139
|
+
return undefined
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var res = this.head.value
|
|
143
|
+
this.head = this.head.next
|
|
144
|
+
if (this.head) {
|
|
145
|
+
this.head.prev = null
|
|
146
|
+
} else {
|
|
147
|
+
this.tail = null
|
|
148
|
+
}
|
|
149
|
+
this.length--
|
|
150
|
+
return res
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
Yallist.prototype.forEach = function (fn, thisp) {
|
|
154
|
+
thisp = thisp || this
|
|
155
|
+
for (var walker = this.head, i = 0; walker !== null; i++) {
|
|
156
|
+
fn.call(thisp, walker.value, i, this)
|
|
157
|
+
walker = walker.next
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
Yallist.prototype.forEachReverse = function (fn, thisp) {
|
|
162
|
+
thisp = thisp || this
|
|
163
|
+
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
|
164
|
+
fn.call(thisp, walker.value, i, this)
|
|
165
|
+
walker = walker.prev
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
Yallist.prototype.get = function (n) {
|
|
170
|
+
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
|
171
|
+
// abort out of the list early if we hit a cycle
|
|
172
|
+
walker = walker.next
|
|
173
|
+
}
|
|
174
|
+
if (i === n && walker !== null) {
|
|
175
|
+
return walker.value
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
Yallist.prototype.getReverse = function (n) {
|
|
180
|
+
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
|
181
|
+
// abort out of the list early if we hit a cycle
|
|
182
|
+
walker = walker.prev
|
|
183
|
+
}
|
|
184
|
+
if (i === n && walker !== null) {
|
|
185
|
+
return walker.value
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
Yallist.prototype.map = function (fn, thisp) {
|
|
190
|
+
thisp = thisp || this
|
|
191
|
+
var res = new Yallist()
|
|
192
|
+
for (var walker = this.head; walker !== null;) {
|
|
193
|
+
res.push(fn.call(thisp, walker.value, this))
|
|
194
|
+
walker = walker.next
|
|
195
|
+
}
|
|
196
|
+
return res
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
Yallist.prototype.mapReverse = function (fn, thisp) {
|
|
200
|
+
thisp = thisp || this
|
|
201
|
+
var res = new Yallist()
|
|
202
|
+
for (var walker = this.tail; walker !== null;) {
|
|
203
|
+
res.push(fn.call(thisp, walker.value, this))
|
|
204
|
+
walker = walker.prev
|
|
205
|
+
}
|
|
206
|
+
return res
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
Yallist.prototype.reduce = function (fn, initial) {
|
|
210
|
+
var acc
|
|
211
|
+
var walker = this.head
|
|
212
|
+
if (arguments.length > 1) {
|
|
213
|
+
acc = initial
|
|
214
|
+
} else if (this.head) {
|
|
215
|
+
walker = this.head.next
|
|
216
|
+
acc = this.head.value
|
|
217
|
+
} else {
|
|
218
|
+
throw new TypeError('Reduce of empty list with no initial value')
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
for (var i = 0; walker !== null; i++) {
|
|
222
|
+
acc = fn(acc, walker.value, i)
|
|
223
|
+
walker = walker.next
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return acc
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
Yallist.prototype.reduceReverse = function (fn, initial) {
|
|
230
|
+
var acc
|
|
231
|
+
var walker = this.tail
|
|
232
|
+
if (arguments.length > 1) {
|
|
233
|
+
acc = initial
|
|
234
|
+
} else if (this.tail) {
|
|
235
|
+
walker = this.tail.prev
|
|
236
|
+
acc = this.tail.value
|
|
237
|
+
} else {
|
|
238
|
+
throw new TypeError('Reduce of empty list with no initial value')
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
for (var i = this.length - 1; walker !== null; i--) {
|
|
242
|
+
acc = fn(acc, walker.value, i)
|
|
243
|
+
walker = walker.prev
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return acc
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
Yallist.prototype.toArray = function () {
|
|
250
|
+
var arr = new Array(this.length)
|
|
251
|
+
for (var i = 0, walker = this.head; walker !== null; i++) {
|
|
252
|
+
arr[i] = walker.value
|
|
253
|
+
walker = walker.next
|
|
254
|
+
}
|
|
255
|
+
return arr
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
Yallist.prototype.toArrayReverse = function () {
|
|
259
|
+
var arr = new Array(this.length)
|
|
260
|
+
for (var i = 0, walker = this.tail; walker !== null; i++) {
|
|
261
|
+
arr[i] = walker.value
|
|
262
|
+
walker = walker.prev
|
|
263
|
+
}
|
|
264
|
+
return arr
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
Yallist.prototype.slice = function (from, to) {
|
|
268
|
+
to = to || this.length
|
|
269
|
+
if (to < 0) {
|
|
270
|
+
to += this.length
|
|
271
|
+
}
|
|
272
|
+
from = from || 0
|
|
273
|
+
if (from < 0) {
|
|
274
|
+
from += this.length
|
|
275
|
+
}
|
|
276
|
+
var ret = new Yallist()
|
|
277
|
+
if (to < from || to < 0) {
|
|
278
|
+
return ret
|
|
279
|
+
}
|
|
280
|
+
if (from < 0) {
|
|
281
|
+
from = 0
|
|
282
|
+
}
|
|
283
|
+
if (to > this.length) {
|
|
284
|
+
to = this.length
|
|
285
|
+
}
|
|
286
|
+
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
|
287
|
+
walker = walker.next
|
|
288
|
+
}
|
|
289
|
+
for (; walker !== null && i < to; i++, walker = walker.next) {
|
|
290
|
+
ret.push(walker.value)
|
|
291
|
+
}
|
|
292
|
+
return ret
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
Yallist.prototype.sliceReverse = function (from, to) {
|
|
296
|
+
to = to || this.length
|
|
297
|
+
if (to < 0) {
|
|
298
|
+
to += this.length
|
|
299
|
+
}
|
|
300
|
+
from = from || 0
|
|
301
|
+
if (from < 0) {
|
|
302
|
+
from += this.length
|
|
303
|
+
}
|
|
304
|
+
var ret = new Yallist()
|
|
305
|
+
if (to < from || to < 0) {
|
|
306
|
+
return ret
|
|
307
|
+
}
|
|
308
|
+
if (from < 0) {
|
|
309
|
+
from = 0
|
|
310
|
+
}
|
|
311
|
+
if (to > this.length) {
|
|
312
|
+
to = this.length
|
|
313
|
+
}
|
|
314
|
+
for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
|
|
315
|
+
walker = walker.prev
|
|
316
|
+
}
|
|
317
|
+
for (; walker !== null && i > from; i--, walker = walker.prev) {
|
|
318
|
+
ret.push(walker.value)
|
|
319
|
+
}
|
|
320
|
+
return ret
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
|
|
324
|
+
if (start > this.length) {
|
|
325
|
+
start = this.length - 1
|
|
326
|
+
}
|
|
327
|
+
if (start < 0) {
|
|
328
|
+
start = this.length + start;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
|
|
332
|
+
walker = walker.next
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
var ret = []
|
|
336
|
+
for (var i = 0; walker && i < deleteCount; i++) {
|
|
337
|
+
ret.push(walker.value)
|
|
338
|
+
walker = this.removeNode(walker)
|
|
339
|
+
}
|
|
340
|
+
if (walker === null) {
|
|
341
|
+
walker = this.tail
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (walker !== this.head && walker !== this.tail) {
|
|
345
|
+
walker = walker.prev
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
349
|
+
walker = insert(this, walker, nodes[i])
|
|
350
|
+
}
|
|
351
|
+
return ret;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
Yallist.prototype.reverse = function () {
|
|
355
|
+
var head = this.head
|
|
356
|
+
var tail = this.tail
|
|
357
|
+
for (var walker = head; walker !== null; walker = walker.prev) {
|
|
358
|
+
var p = walker.prev
|
|
359
|
+
walker.prev = walker.next
|
|
360
|
+
walker.next = p
|
|
361
|
+
}
|
|
362
|
+
this.head = tail
|
|
363
|
+
this.tail = head
|
|
364
|
+
return this
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function insert (self, node, value) {
|
|
368
|
+
var inserted = node === self.head ?
|
|
369
|
+
new Node(value, null, node, self) :
|
|
370
|
+
new Node(value, node, node.next, self)
|
|
371
|
+
|
|
372
|
+
if (inserted.next === null) {
|
|
373
|
+
self.tail = inserted
|
|
374
|
+
}
|
|
375
|
+
if (inserted.prev === null) {
|
|
376
|
+
self.head = inserted
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
self.length++
|
|
380
|
+
|
|
381
|
+
return inserted
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function push (self, item) {
|
|
385
|
+
self.tail = new Node(item, self.tail, null, self)
|
|
386
|
+
if (!self.head) {
|
|
387
|
+
self.head = self.tail
|
|
388
|
+
}
|
|
389
|
+
self.length++
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function unshift (self, item) {
|
|
393
|
+
self.head = new Node(item, null, self.head, self)
|
|
394
|
+
if (!self.tail) {
|
|
395
|
+
self.tail = self.head
|
|
396
|
+
}
|
|
397
|
+
self.length++
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function Node (value, prev, next, list) {
|
|
401
|
+
if (!(this instanceof Node)) {
|
|
402
|
+
return new Node(value, prev, next, list)
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
this.list = list
|
|
406
|
+
this.value = value
|
|
407
|
+
|
|
408
|
+
if (prev) {
|
|
409
|
+
prev.next = this
|
|
410
|
+
this.prev = prev
|
|
411
|
+
} else {
|
|
412
|
+
this.prev = null
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (next) {
|
|
416
|
+
next.prev = this
|
|
417
|
+
this.next = next
|
|
418
|
+
} else {
|
|
419
|
+
this.next = null
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
try {
|
|
424
|
+
// add if support for Symbol.iterator is present
|
|
425
|
+
require('./iterator.js')(Yallist)
|
|
426
|
+
} catch (er) {}
|
package/package.json
CHANGED
|
@@ -5,6 +5,32 @@
|
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/AminFazlMondo/deployable-awscdk-app-ts.git"
|
|
7
7
|
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "npx projen build",
|
|
10
|
+
"bump": "npx projen bump",
|
|
11
|
+
"clobber": "npx projen clobber",
|
|
12
|
+
"compat": "npx projen compat",
|
|
13
|
+
"compile": "npx projen compile",
|
|
14
|
+
"default": "npx projen default",
|
|
15
|
+
"docgen": "npx projen docgen",
|
|
16
|
+
"eject": "npx projen eject",
|
|
17
|
+
"eslint": "npx projen eslint",
|
|
18
|
+
"package": "npx projen package",
|
|
19
|
+
"package-all": "npx projen package-all",
|
|
20
|
+
"package:js": "npx projen package:js",
|
|
21
|
+
"post-compile": "npx projen post-compile",
|
|
22
|
+
"post-upgrade": "npx projen post-upgrade",
|
|
23
|
+
"pre-compile": "npx projen pre-compile",
|
|
24
|
+
"publish:github": "npx projen publish:github",
|
|
25
|
+
"publish:npm": "npx projen publish:npm",
|
|
26
|
+
"release": "npx projen release",
|
|
27
|
+
"test": "npx projen test",
|
|
28
|
+
"test:watch": "npx projen test:watch",
|
|
29
|
+
"unbump": "npx projen unbump",
|
|
30
|
+
"upgrade": "npx projen upgrade",
|
|
31
|
+
"watch": "npx projen watch",
|
|
32
|
+
"projen": "npx projen"
|
|
33
|
+
},
|
|
8
34
|
"author": {
|
|
9
35
|
"name": "Amin Fazl",
|
|
10
36
|
"email": "amin.fazl@mondo.com.au",
|
|
@@ -55,7 +81,7 @@
|
|
|
55
81
|
],
|
|
56
82
|
"main": "lib/index.js",
|
|
57
83
|
"license": "Apache-2.0",
|
|
58
|
-
"version": "0.1.
|
|
84
|
+
"version": "0.1.316",
|
|
59
85
|
"jest": {
|
|
60
86
|
"testMatch": [
|
|
61
87
|
"<rootDir>/src/**/__tests__/**/*.ts?(x)",
|
|
@@ -108,31 +134,5 @@
|
|
|
108
134
|
"rootDir": "src"
|
|
109
135
|
}
|
|
110
136
|
},
|
|
111
|
-
"//": "~~ Generated by projen. To modify, edit .projenrc.ts and run \"npx projen\"."
|
|
112
|
-
|
|
113
|
-
"build": "npx projen build",
|
|
114
|
-
"bump": "npx projen bump",
|
|
115
|
-
"clobber": "npx projen clobber",
|
|
116
|
-
"compat": "npx projen compat",
|
|
117
|
-
"compile": "npx projen compile",
|
|
118
|
-
"default": "npx projen default",
|
|
119
|
-
"docgen": "npx projen docgen",
|
|
120
|
-
"eject": "npx projen eject",
|
|
121
|
-
"eslint": "npx projen eslint",
|
|
122
|
-
"package": "npx projen package",
|
|
123
|
-
"package-all": "npx projen package-all",
|
|
124
|
-
"package:js": "npx projen package:js",
|
|
125
|
-
"post-compile": "npx projen post-compile",
|
|
126
|
-
"post-upgrade": "npx projen post-upgrade",
|
|
127
|
-
"pre-compile": "npx projen pre-compile",
|
|
128
|
-
"publish:github": "npx projen publish:github",
|
|
129
|
-
"publish:npm": "npx projen publish:npm",
|
|
130
|
-
"release": "npx projen release",
|
|
131
|
-
"test": "npx projen test",
|
|
132
|
-
"test:watch": "npx projen test:watch",
|
|
133
|
-
"unbump": "npx projen unbump",
|
|
134
|
-
"upgrade": "npx projen upgrade",
|
|
135
|
-
"watch": "npx projen watch",
|
|
136
|
-
"projen": "npx projen"
|
|
137
|
-
}
|
|
138
|
-
}
|
|
137
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.ts and run \"npx projen\"."
|
|
138
|
+
}
|