Skip to content

Commit 5286d24

Browse files
authored
Merge pull request #219 from BobClaerhout/addIlikeFilterToJS
add ILike filter to JS library
2 parents 7fb7ad5 + 4c58671 commit 5286d24

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

javascript/lib/api/src/options/filter.options.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,18 @@ export const Like: (property: string, form: string) => Filter =
169169
return standardFilter('like', property, form);
170170
};
171171

172+
/**
173+
* Builds a ilike-Filter. The body of the property must conform to the form provided.
174+
*
175+
* @param property - The property to check.
176+
* @param form - The values to check for.
177+
* @return The ilike-Filter.
178+
*/
179+
export const ILike: (property: string, form: string) => Filter =
180+
(property: string, form: string) => {
181+
return standardFilter('ilike', property, form);
182+
};
183+
172184
/**
173185
* Builds a exists-Filter. The property must exist.
174186
*

javascript/lib/api/tests/options/filter.options.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* SPDX-License-Identifier: EPL-2.0
1212
*/
1313

14-
import { And, Eq, Exists, Ge, Gt, In, Le, Like, Lt, Ne, Not, Or } from '../../src/options/filter.options';
14+
import { And, Eq, Exists, Ge, Gt, ILike, In, Le, Like, Lt, Ne, Not, Or } from '../../src/options/filter.options';
1515

1616
describe('Filters', () => {
1717

@@ -98,6 +98,11 @@ describe('Filters', () => {
9898
expect(like.toString()).toEqual(`like(${prop},"*test*")`);
9999
});
100100

101+
it('builds an ilike', () => {
102+
const ilike = ILike(prop, '*test*');
103+
expect(ilike.toString()).toEqual(`ilike(${prop},"*test*")`);
104+
});
105+
101106
it('builds an exists', () => {
102107
const exists = Exists(prop);
103108
expect(exists.toString()).toEqual(`exists(${prop})`);

0 commit comments

Comments
 (0)