Skip to content

Commit 55dad0c

Browse files
committed
Add 'doesNotStartWith' operator to Neo.collection.Filter #7898
1 parent 861b526 commit 55dad0c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/collection/Filter.mjs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class Filter extends Base {
2121
* @static
2222
*/
2323
static operators = [
24-
'==', '===', '!=', '!==', '<', '<=', '>', '>=', 'endsWith', 'excluded', 'included',
25-
'isDefined', 'isUndefined', 'like', 'startsWith'
24+
'==', '===', '!=', '!==', '<', '<=', '>', '>=', 'doesNotStartWith', 'endsWith', 'excluded',
25+
'included', 'isDefined', 'isUndefined', 'like', 'startsWith'
2626
]
2727

2828
static config = {
@@ -224,6 +224,13 @@ class Filter extends Base {
224224
static ['>'] (a, b) {return a > b}
225225
static ['>='] (a, b) {return a >= b}
226226

227+
static ['doesNotStartWith'](a, b) {
228+
if (!Neo.isString(a)) {a = String(a)}
229+
if (!Neo.isString(b)) {b = String(b)}
230+
231+
return !a?.toLowerCase().startsWith(b?.toLowerCase())
232+
}
233+
227234
static ['endsWith'](a, b) {
228235
if (!Neo.isString(a)) {a = String(a)}
229236
if (!Neo.isString(b)) {b = String(b)}

0 commit comments

Comments
 (0)