fix: replace custom isInteger function with Number.isInteger

This commit is contained in:
Tom French 2022-07-29 00:00:38 +01:00 committed by James Long
parent 75da379079
commit fb3e12b8a7

View file

@ -10,10 +10,6 @@ import {
import q from '../shared/query'; import q from '../shared/query';
import { currencyToAmount, amountToInteger } from '../shared/util'; import { currencyToAmount, amountToInteger } from '../shared/util';
function isInteger(num) {
return (num | 0) === num;
}
export function getAccountFilter(accountId, field = 'account') { export function getAccountFilter(accountId, field = 'account') {
if (accountId) { if (accountId) {
if (accountId === 'budgeted') { if (accountId === 'budgeted') {
@ -82,7 +78,7 @@ export function makeTransactionSearchQuery(currentQuery, search, dateFormat) {
amount: { $transform: '$abs', $eq: amountToInteger(amount) } amount: { $transform: '$abs', $eq: amountToInteger(amount) }
}, },
amount != null && amount != null &&
isInteger(amount) && { Number.isInteger(amount) && {
amount: { amount: {
$transform: { $abs: { $idiv: ['$', 100] } }, $transform: { $abs: { $idiv: ['$', 100] } },
$eq: amount $eq: amount