hd-utils
Version:
A handy utils for modern JS developers
8 lines (7 loc) • 432 B
TypeScript
import { ParseStringOptions } from '../types';
/**
* @description It takes a string and returns a number, boolean, null, undefined, or a string that has "undefined" as string
* and returns the actual type.
* if "123" will return the number 123 and so on.
*/
export default function parseString<T = number | undefined | null | string | boolean | [] | {}>(str: string | null | undefined | number, config?: ParseStringOptions): T;