getTypeOf
type: function
The getTypeof function extends native typeof with more precise distinctions.
Usage
import { getTypeof } from '@mustib/utils';
getTypeof('x'); // stringgetTypeof(NaN); // NaNgetTypeof([]); // arraygetTypeof(new Uint8Array()); // buffergetTypeof(new Date('invalid')); // invalid_dateDefinition
function getTypeof(value: any): string { }Parameters
-
valuetype value = any;- Value to inspect.
Returns
type T = string;- Possible values include:
- `buffer`, `string`, `boolean`, `undefined`, `function`, `symbol`.
- `number`, `NaN`, `array`, `null`, `invalid_date`, `date`, `object`, `unknown`.