Fix European trip return heuristic for weekend location tracking
Adjust European short trip heuristic from >3 days to >1 day to correctly detect when user has returned home from European trips. This fixes the April 29-30, 2023 case where the location incorrectly showed "Sankt Georg, Hamburg" instead of "Bristol" when the user was free (no events scheduled) after the foss-north trip ended on April 27. The previous logic required more than 3 days to pass before assuming return home from European countries, but for short European trips by rail/ferry, users typically return within 1-2 days. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
663dc479c2
commit
ea4980a5d7
6407 changed files with 1072847 additions and 18 deletions
56
node_modules/yocto-queue/index.d.ts
generated
vendored
Normal file
56
node_modules/yocto-queue/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
declare class Queue<ValueType> implements Iterable<ValueType> {
|
||||
/**
|
||||
The size of the queue.
|
||||
*/
|
||||
readonly size: number;
|
||||
|
||||
/**
|
||||
Tiny queue data structure.
|
||||
|
||||
The instance is an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols), which means you can iterate over the queue front to back with a “for…of” loop, or use spreading to convert the queue to an array. Don't do this unless you really need to though, since it's slow.
|
||||
|
||||
@example
|
||||
```
|
||||
import Queue = require('yocto-queue');
|
||||
|
||||
const queue = new Queue();
|
||||
|
||||
queue.enqueue('🦄');
|
||||
queue.enqueue('🌈');
|
||||
|
||||
console.log(queue.size);
|
||||
//=> 2
|
||||
|
||||
console.log(...queue);
|
||||
//=> '🦄 🌈'
|
||||
|
||||
console.log(queue.dequeue());
|
||||
//=> '🦄'
|
||||
|
||||
console.log(queue.dequeue());
|
||||
//=> '🌈'
|
||||
```
|
||||
*/
|
||||
constructor();
|
||||
|
||||
[Symbol.iterator](): IterableIterator<ValueType>;
|
||||
|
||||
/**
|
||||
Add a value to the queue.
|
||||
*/
|
||||
enqueue(value: ValueType): void;
|
||||
|
||||
/**
|
||||
Remove the next value in the queue.
|
||||
|
||||
@returns The removed value or `undefined` if the queue is empty.
|
||||
*/
|
||||
dequeue(): ValueType | undefined;
|
||||
|
||||
/**
|
||||
Clear the queue.
|
||||
*/
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
export = Queue;
|
||||
68
node_modules/yocto-queue/index.js
generated
vendored
Normal file
68
node_modules/yocto-queue/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
class Node {
|
||||
/// value;
|
||||
/// next;
|
||||
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
|
||||
// TODO: Remove this when targeting Node.js 12.
|
||||
this.next = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
class Queue {
|
||||
// TODO: Use private class fields when targeting Node.js 12.
|
||||
// #_head;
|
||||
// #_tail;
|
||||
// #_size;
|
||||
|
||||
constructor() {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
enqueue(value) {
|
||||
const node = new Node(value);
|
||||
|
||||
if (this._head) {
|
||||
this._tail.next = node;
|
||||
this._tail = node;
|
||||
} else {
|
||||
this._head = node;
|
||||
this._tail = node;
|
||||
}
|
||||
|
||||
this._size++;
|
||||
}
|
||||
|
||||
dequeue() {
|
||||
const current = this._head;
|
||||
if (!current) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._head = this._head.next;
|
||||
this._size--;
|
||||
return current.value;
|
||||
}
|
||||
|
||||
clear() {
|
||||
this._head = undefined;
|
||||
this._tail = undefined;
|
||||
this._size = 0;
|
||||
}
|
||||
|
||||
get size() {
|
||||
return this._size;
|
||||
}
|
||||
|
||||
* [Symbol.iterator]() {
|
||||
let current = this._head;
|
||||
|
||||
while (current) {
|
||||
yield current.value;
|
||||
current = current.next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Queue;
|
||||
9
node_modules/yocto-queue/license
generated
vendored
Normal file
9
node_modules/yocto-queue/license
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.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.
|
||||
43
node_modules/yocto-queue/package.json
generated
vendored
Normal file
43
node_modules/yocto-queue/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "yocto-queue",
|
||||
"version": "0.1.0",
|
||||
"description": "Tiny queue data structure",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/yocto-queue",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"queue",
|
||||
"data",
|
||||
"structure",
|
||||
"algorithm",
|
||||
"queues",
|
||||
"queuing",
|
||||
"list",
|
||||
"array",
|
||||
"linkedlist",
|
||||
"fifo",
|
||||
"enqueue",
|
||||
"dequeue",
|
||||
"data-structure"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"tsd": "^0.13.1",
|
||||
"xo": "^0.35.0"
|
||||
}
|
||||
}
|
||||
64
node_modules/yocto-queue/readme.md
generated
vendored
Normal file
64
node_modules/yocto-queue/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# yocto-queue [](https://bundlephobia.com/result?p=yocto-queue)
|
||||
|
||||
> Tiny queue data structure
|
||||
|
||||
You should use this package instead of an array if you do a lot of `Array#push()` and `Array#shift()` on large arrays, since `Array#shift()` has [linear time complexity](https://medium.com/@ariel.salem1989/an-easy-to-use-guide-to-big-o-time-complexity-5dcf4be8a444#:~:text=O(N)%E2%80%94Linear%20Time) *O(n)* while `Queue#dequeue()` has [constant time complexity](https://medium.com/@ariel.salem1989/an-easy-to-use-guide-to-big-o-time-complexity-5dcf4be8a444#:~:text=O(1)%20%E2%80%94%20Constant%20Time) *O(1)*. That makes a huge difference for large arrays.
|
||||
|
||||
> A [queue](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) is an ordered list of elements where an element is inserted at the end of the queue and is removed from the front of the queue. A queue works based on the first-in, first-out ([FIFO](https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics))) principle.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install yocto-queue
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const Queue = require('yocto-queue');
|
||||
|
||||
const queue = new Queue();
|
||||
|
||||
queue.enqueue('🦄');
|
||||
queue.enqueue('🌈');
|
||||
|
||||
console.log(queue.size);
|
||||
//=> 2
|
||||
|
||||
console.log(...queue);
|
||||
//=> '🦄 🌈'
|
||||
|
||||
console.log(queue.dequeue());
|
||||
//=> '🦄'
|
||||
|
||||
console.log(queue.dequeue());
|
||||
//=> '🌈'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `queue = new Queue()`
|
||||
|
||||
The instance is an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols), which means you can iterate over the queue front to back with a “for…of” loop, or use spreading to convert the queue to an array. Don't do this unless you really need to though, since it's slow.
|
||||
|
||||
#### `.enqueue(value)`
|
||||
|
||||
Add a value to the queue.
|
||||
|
||||
#### `.dequeue()`
|
||||
|
||||
Remove the next value in the queue.
|
||||
|
||||
Returns the removed value or `undefined` if the queue is empty.
|
||||
|
||||
#### `.clear()`
|
||||
|
||||
Clear the queue.
|
||||
|
||||
#### `.size`
|
||||
|
||||
The size of the queue.
|
||||
|
||||
## Related
|
||||
|
||||
- [quick-lru](https://github.com/sindresorhus/quick-lru) - Simple “Least Recently Used” (LRU) cache
|
||||
Loading…
Add table
Add a link
Reference in a new issue