@rushstack/lookup-by-path
Advanced tools
Comparing version 0.2.5 to 0.3.0
@@ -5,2 +5,14 @@ { | ||
{ | ||
"version": "0.3.0", | ||
"tag": "@rushstack/lookup-by-path_v0.3.0", | ||
"date": "Thu, 03 Oct 2024 15:11:00 GMT", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"comment": "Allow for a map of file paths to arbitrary info to be grouped by the nearest entry in the LookupByPath trie" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "0.2.5", | ||
@@ -7,0 +19,0 @@ "tag": "@rushstack/lookup-by-path_v0.2.5", |
# Change Log - @rushstack/lookup-by-path | ||
This log was last generated on Wed, 02 Oct 2024 00:11:19 GMT and should not be manually modified. | ||
This log was last generated on Thu, 03 Oct 2024 15:11:00 GMT and should not be manually modified. | ||
## 0.3.0 | ||
Thu, 03 Oct 2024 15:11:00 GMT | ||
### Minor changes | ||
- Allow for a map of file paths to arbitrary info to be grouped by the nearest entry in the LookupByPath trie | ||
## 0.2.5 | ||
@@ -6,0 +13,0 @@ Wed, 02 Oct 2024 00:11:19 GMT |
@@ -131,2 +131,11 @@ /** | ||
/** | ||
* Groups the provided map of info by the nearest entry in the trie that contains the path. If the path | ||
* is not found in the trie, the info is ignored. | ||
* | ||
* @returns The grouped info, grouped by the nearest entry in the trie that contains the path | ||
* | ||
* @param infoByPath - The info to be grouped, keyed by path | ||
*/ | ||
groupByChild<TInfo>(infoByPath: Map<string, TInfo>): Map<TItem, Map<string, TInfo>>; | ||
/** | ||
* Iterates through progressively longer prefixes of a given string and returns as soon | ||
@@ -133,0 +142,0 @@ * as the number of candidate items that match the prefix are 1 or 0. |
@@ -124,2 +124,11 @@ /** | ||
/** | ||
* Groups the provided map of info by the nearest entry in the trie that contains the path. If the path | ||
* is not found in the trie, the info is ignored. | ||
* | ||
* @returns The grouped info, grouped by the nearest entry in the trie that contains the path | ||
* | ||
* @param infoByPath - The info to be grouped, keyed by path | ||
*/ | ||
groupByChild<TInfo>(infoByPath: Map<string, TInfo>): Map<TItem, Map<string, TInfo>>; | ||
/** | ||
* Iterates through progressively longer prefixes of a given string and returns as soon | ||
@@ -126,0 +135,0 @@ * as the number of candidate items that match the prefix are 1 or 0. |
@@ -181,2 +181,26 @@ "use strict"; | ||
/** | ||
* Groups the provided map of info by the nearest entry in the trie that contains the path. If the path | ||
* is not found in the trie, the info is ignored. | ||
* | ||
* @returns The grouped info, grouped by the nearest entry in the trie that contains the path | ||
* | ||
* @param infoByPath - The info to be grouped, keyed by path | ||
*/ | ||
groupByChild(infoByPath) { | ||
const groupedInfoByChild = new Map(); | ||
for (const [path, info] of infoByPath) { | ||
const child = this.findChildPath(path); | ||
if (child === undefined) { | ||
continue; | ||
} | ||
let groupedInfo = groupedInfoByChild.get(child); | ||
if (!groupedInfo) { | ||
groupedInfo = new Map(); | ||
groupedInfoByChild.set(child, groupedInfo); | ||
} | ||
groupedInfo.set(path, info); | ||
} | ||
return groupedInfoByChild; | ||
} | ||
/** | ||
* Iterates through progressively longer prefixes of a given string and returns as soon | ||
@@ -183,0 +207,0 @@ * as the number of candidate items that match the prefix are 1 or 0. |
{ | ||
"name": "@rushstack/lookup-by-path", | ||
"version": "0.2.5", | ||
"version": "0.3.0", | ||
"description": "Strongly typed trie data structure for path and URL-like strings.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
682
43163
15