UNPKG

@magnetarjs/utils

Version:

Magnetar utils like a logger for easier development

18 lines (17 loc) 467 B
import { isAnyObject, isFunction } from 'is-what'; /** * Parses a value found at the field path, in order to be able to make a better comparison. * * TODO: find a way for the plugins to be able to define this. */ export function parseValueForFilters(val) { try { if (isAnyObject(val) && 'toDate' in val && isFunction(val['toDate'])) { return val['toDate'](); } } catch (error) { return val; } return val; }