@kietpt2003/react-native-core-ui
Version:
React Native Core UI components by KietPT
47 lines • 1.77 kB
TypeScript
/**
* This function converts input into a string.
* * If the input is null or undefined, it returns an empty string.
* * If the input is an object, it returns a stringified version of the object.
* * Otherwise, it returns the string representation of the input.
* @example
* ```js
* import { convertString } from '@kietpt2003/react-native-core-ui/utils';
* const str = convertString(2003); // "2003"
* ```
*/
export declare const convertString: (value: any) => string;
/**
* This function converts input into a number.
* * If the input is null or undefined, it returns 0.
* * If the input is not a number, it returns 0.
* * Otherwise, it returns the parsed float value of the input.
* @example
* ```js
* import { convertNumber } from '@kietpt2003/react-native-core-ui/utils';
* const num = convertNumber("2003"); // 2003
* ```
*/
export declare const convertNumber: (value: any) => number;
/**
* Function to convert seconds to a string in the format "mm:ss".
* * If the input is less than 0, it returns "00:00".
* * If the input is greater than 3599, it returns "00:00".
* @example
* ```js
* import { convertSeconds } from '@kietpt2003/react-native-core-ui/utils';
* const time = convertSeconds(123); // "02:03"
* ```
*/
export declare const convertSeconds: (seconds?: number) => string;
/**
* Function to format seconds into a string in the format "hh:mm:ss".
* * If the input is less than 0, it returns "00:00:00".
* * If the input is greater than 86399, it returns "00:00:00".
* @example
* ```js
* import { formatHour } from '@kietpt2003/react-native-core-ui/utils';
* const time = formatHour(3661); // "01:01:01"
* ```
*/
export declare const formatHour: (seconds?: number) => string;
//# sourceMappingURL=converter.d.ts.map