geobase/src/utils/int-or-null.ts

7 lines
156 B
TypeScript
Raw Normal View History

2023-01-01 09:40:19 +00:00
export const intOrNull = (ref: string) => {
if (!ref) return null;
const parse = parseInt(ref, 10);
if (isNaN(parse)) return null;
return parse;
};