mingo
Version:
MongoDB query language for in-memory objects
14 lines (13 loc) • 420 B
JavaScript
import { computeValue } from "../../../core/_internal";
import { isInteger, isNil } from "../../../util";
import { errExpectNumber, INT_OPTS } from "../_internal";
const $bitNot = (obj, expr, options) => {
const n = computeValue(obj, expr, null, options);
if (isNil(n)) return null;
if (!isInteger(n))
return errExpectNumber(options.failOnError, "$bitNot", INT_OPTS.int);
return ~n;
};
export {
$bitNot
};