Skip to content

Commit fb6f2c6

Browse files
FeresaulCopilot
andauthored
Update filter function documentation and re-enable npm test step in CI (#11)
* Update filter function documentation and re-enable npm test step in CI * Update lib/utils/filter.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Remove npm test step from npm-publish workflow and add PR tests workflow --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 70fe009 commit fb6f2c6

4 files changed

Lines changed: 28 additions & 42 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
with:
1414
node-version: 20
1515
- run: npm ci
16-
#- run: npm test
1716

1817
publish-npm:
1918
needs: build

.github/workflows/pr-tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: PR Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Run tests
25+
run: npm test

.github/workflows/tag-creation.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

lib/utils/filter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ type FilterValue = string | number | boolean | string[] | number[];
1111
* @param key The key to filter by.
1212
* @param filter The value to filter by. This can be a single value or an array of values.
1313
* It also supports a function that takes the value of the key and returns a boolean.
14-
* @param mode The mode of filtering. 'strict' checks for exact matches, while 'loose' allows for partial matches.
15-
* Only applies to array filter values.
16-
* This is ignored if custom filter function is provided.
14+
* @param strict When set to true (default), checks for exact matches between arrays.
15+
* This only applies if both the `filter` and the key's value are arrays.
16+
* Ignored if a custom filter function is provided or if `filter` is not an array.
1717
* @returns A new array of objects that match the specified key-value pair.
1818
*/
1919
export const filterByKeyValue = <T extends TObject>(

0 commit comments

Comments
 (0)