question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow to use only specific operators

See original GitHub issue

It may be useful to expose all operators separately and allow users to create own instance of sift that supports only specific operators.

benefits form this:

  1. We can reduce bundle size on client (by using tree-shaking feature)
  2. We can restrict users to use only allowed operators (e.g., forbid usage of $where)
  3. Potentially separation on operators and execution engine may allow to implement processing of async conditions easier

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
stalniycommented, Jun 30, 2019

Exactly!

1reaction
crcncommented, Jun 21, 2019

Do you mean to import operators separately into sift? E.g:

import sift from 'sift';
import * as operators from 'sift/operators';

const filter = sift({ operators });

Additionally, operators could be separated out into individual files:

import sift from 'sift';
import $where from 'sift/operators/$where';
import $in from 'sift/operators/$in';
import $eq from 'sift/operators/$in';

const filter = sift({ operators: {$where, $in, $eq} });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Could I use operator == if I only implemented operator
No. This method works well on number-like objects that is called totally ordered. For all kinds of set/class, no one can guarantee this...
Read more >
operator overloading - cppreference.com
[edit] Overloaded operators. When an operator appears in an expression, and at least one of its operands has a class type or an...
Read more >
Search Operators | GovInfo
Proximity Operators allow you to specify searches where one word is near, next to, or in the vicinity of another word.
Read more >
Overloading operators (C++ only) - IBM
You can redefine or overload the function of most built-in operators in C++. These operators can be overloaded globally or on a class-by-class...
Read more >
Operator Overloading, C++ FAQ - Standard C++
Operator overloading allows C/C++ operators to have user-defined meanings on ... usually be many people who use your class, but there is only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found