Skip to content

Commit 9bdb036

Browse files
committed
update
1 parent 1151c43 commit 9bdb036

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

typescript/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ make(factors, { // optional
6868
length: 2,
6969
// SuggestRowType<typeof factors> is { machine: string, os: string, browser: string }
7070
preFilter: (row: SuggestRowType<typeof factors>) => !(row.os === 'Android' && row.machine !== 'Pixel'), // default: null
71-
// Or DictType that is { [key: string]: string }
71+
// Or DictType that is { [key: string]: any }
7272
postFilter: (row: DictType) => !(row.os === 'iOS' && row.browser !== 'Safari'), // default: null
7373
});
7474
```
@@ -109,8 +109,8 @@ Obviously the more it increases, the more number of combinations increases.
109109
### sorter
110110
Determines the order of combinations.
111111

112-
- sorters.random: It makes different combinations everytime. (fastest)
113-
- sorters.hash: It makes combinations depending on hash of the pair and seed. (default)
112+
- sorters.random: Generates different combinations each time. (fastest)
113+
- sorters.hash: Uses a hash-based method for reproducibility. (default)
114114

115115
- It receives `seed`.
116116
- `seed` option decides the order of storing from unstored pairs.
@@ -119,8 +119,8 @@ Determines the order of combinations.
119119
### criterion
120120
Determines the efficiency of combinations.
121121

122-
- `criteria.simple`: it extracts any pairs that can be stored into the processing row.
123-
- `criteria.greedy`: it attempts to make most efficient combinations. (default)
122+
- `criteria.simple`: Quickly generates combinations.
123+
- `criteria.greedy`: Attempts to minimize the number of combinations, but is more time-intensive. (default)
124124
- It receives [tolerance](https://github.com/walkframe/covertable#tolerance) option.
125125

126126
While `criteria.simple` processes quickly, `criteria.greedy` makes fewer combinations.

typescript/src/__tests__/pict.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import { PictConstraintsLexer } from "../utils/pict";
22

33
describe('PictConstraintsLexer with single constraints', () => {
4+
it('Blank', () => {
5+
const lexer = new PictConstraintsLexer(``, true);
6+
expect(lexer.filters.length).toBe(0);
7+
expect(lexer.errors.length).toBe(0);
8+
9+
const row1 = { PRICE: 150, DISCOUNT: 'YES' };
10+
expect(lexer.filter(row1)).toBe(true);
11+
});
12+
413
it('should filter correctly with LIKE and IN conditions', () => {
514
const lexer = new PictConstraintsLexer(`
615
IF [NAME] LIKE "Alic?" THEN [STATUS] IN {"Active", "Pending"} ELSE [AGE] > 20 OR [COUNTRY] = "USA";
@@ -355,7 +364,6 @@ describe('PictConstraintsLexer with invalid constraints', () => {
355364
expect(lexer.errors.length).toBe(1);
356365
expect(lexer.errors[0]).toBe('The leading "IF" is missing, found [NAME]');
357366
});
358-
359367

360368
it('Multiple invalid expressions', () => {
361369
const lexer = new PictConstraintsLexer(`

0 commit comments

Comments
 (0)