source: trip-planner-front/node_modules/rxjs/src/internal/util/isNumeric.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 427 bytes
Line 
1import { isArray } from './isArray';
2
3export function isNumeric(val: any): val is number | string {
4 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
5 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
6 // subtraction forces infinities to NaN
7 // adding 1 corrects loss of precision from parseFloat (#15100)
8 return !isArray(val) && (val - parseFloat(val) + 1) >= 0;
9}
Note: See TracBrowser for help on using the repository browser.