fix: multi-repo local dev (file:../ deps, package exports, missing deps)

This commit is contained in:
Raven Scott
2026-05-21 20:14:54 -04:00
parent 76e3272ced
commit b63275c6cc
802 changed files with 94636 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017 Mathias Buus
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.
+72
View File
@@ -0,0 +1,72 @@
# time-ordered-set
Efficiently maintain a set of nodes ordered by the time they were added to the set
```
npm install time-ordered-set
```
## Usage
``` js
const TOS = require('time-ordered-set')
const s = new TOS()
// add 3 nodes
s.add({
hello: 'world'
})
const node = s.add({
hello: 'welt'
})
s.add({
hello: 'verden'
})
// re-add the 2nd one
s.add(node)
console.log(s.toArray().map(node => node.hello)) // ['world', 'verden', 'welt']
```
## API
#### `const s = new TOS()`
Create a new set
#### `node = s.add(node)`
Add a new node to the set. Will add the properties `node.next` and `node.prev` to the node.
Re-adding the same node will move to the latest node.
#### `node = s.remove(node)`
Remove a node. Will set `node.next` and `node.prev` to `null`.
#### `bool = s.has(node)`
Check if a node has been added.
#### `const array = s.toArray([options])`
Get an ordered array out of all the nodes, ordered from oldest to newest. Use `options.reverse: true` to get from newest to oldest. Set `options.limit: number` if you only want to get a subset.
#### `s.oldest`
Property containing the oldest node.
#### `s.latest`
Property containing the newest node.
#### `s.length`
Property containing how many nodes are in the set.
## License
MIT
+72
View File
@@ -0,0 +1,72 @@
module.exports = class TimeOrderedSet {
constructor () {
this.oldest = null
this.latest = null
this.length = 0
}
has (node) {
return !!(node.next || node.prev) || node === this.oldest
}
add (node) {
if (this.has(node)) this.remove(node)
if (!this.latest && !this.oldest) {
this.latest = this.oldest = node
node.prev = node.next = null
} else {
this.latest.next = node
node.prev = this.latest
node.next = null
this.latest = node
}
this.length++
return node
}
remove (node) {
if (!this.has(node)) return node
if (this.oldest !== node && this.latest !== node) {
node.prev.next = node.next
node.next.prev = node.prev
} else {
if (this.oldest === node) {
this.oldest = node.next
if (this.oldest) this.oldest.prev = null
}
if (this.latest === node) {
this.latest = node.prev
if (this.latest) this.latest.next = null
}
}
node.next = node.prev = null
this.length--
return node
}
toArray ({ limit = Infinity, reverse = false } = {}) {
const list = []
if (reverse) {
let node = this.latest
while (node && limit--) {
list.push(node)
node = node.prev
}
} else {
let node = this.oldest
while (node && limit--) {
list.push(node)
node = node.next
}
}
return list
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"name": "time-ordered-set",
"version": "2.0.1",
"description": "Efficiently maintain a set of nodes ordered by the time they were added to the set",
"main": "index.js",
"files": [
"index.js"
],
"devDependencies": {
"brittle": "^3.0.0",
"standard": "^17.1.2"
},
"scripts": {
"test": "standard && brittle test.js"
},
"repository": {
"type": "git",
"url": "https://github.com/mafintosh/time-ordered-set.git"
},
"author": "Mathias Buus (@mafintosh)",
"license": "MIT",
"bugs": {
"url": "https://github.com/mafintosh/time-ordered-set/issues"
},
"homepage": "https://github.com/mafintosh/time-ordered-set"
}