mingo
Version:
MongoDB query language for in-memory objects
15 lines (14 loc) • 399 B
JavaScript
import { computeValue } from "../../../core/_internal";
import { isNil } from "../../../util";
import { errExpectNumber } from "../_internal";
const $exp = (obj, expr, options) => {
const n = computeValue(obj, expr, null, options);
if (isNil(n)) return null;
if (typeof n !== "number") {
return errExpectNumber(options.failOnError, "$exp");
}
return Math.exp(n);
};
export {
$exp
};