init
This commit is contained in:
8
src/core/utils/parsers.ts
Normal file
8
src/core/utils/parsers.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import {isNumber, isString} from 'lodash';
|
||||
|
||||
export const toNumber = (value: unknown): Undefinable<number> => {
|
||||
if (isNumber(value) || isString(value)) {
|
||||
const prepareValue = Number(value);
|
||||
return Number.isNaN(prepareValue) ? undefined : prepareValue;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user