chore: Add comment to clarify implementation.

This commit is contained in:
João Correia 2022-01-26 18:02:41 +00:00
parent c23031842a
commit 9521b738f7

View File

@ -23,6 +23,10 @@ import * as pipelineOperators from 'mingo/operators/pipeline/index.js';
import * as queryOperators from 'mingo/operators/query/index.js';
import * as projectionOperators from 'mingo/operators/projection/index.js';
// "import * as" is returning different object structures when the connection is being
// imported in the build or when running the tests.
// So we check for the a default object with all the named exports, otherwise the
// returned object has all the named exports.
useOperators(OperatorType.ACCUMULATOR, accumulatorOperators.default || accumulatorOperators);
useOperators(OperatorType.EXPRESSION, expressionOperators.default || expressionOperators);
useOperators(OperatorType.PIPELINE, pipelineOperators.default || pipelineOperators);