keys-converter
Version:
This package provide a util function to convert snake case object keys to camel case
35 lines (34 loc) • 776 B
TypeScript
/**
*
* @param obj `{ key: value }`
* @returns obj `{ key: value }`
*
*
* @argument Result type as Object interface to type the return
* @argument Input type as Object interface to validate arguments type
* @example
* objectKeysToSnakeCaseV2<Result, Input>({});
*
* @example
*
* interface Input {
* goodMorning: string
* goodAfternoon: string
* }
*
* interface Result {
* good_morning: string,
* good_afternoon: string
* }
*
* const result = objectKeysToSnakeCaseV2<Result, Input>(
* {
* goodMorning: "Its a beautiful day",
* goodAfternoon: "Nice afternoon"
* }
* );
*
*/
declare const objectKeysToSnakeCaseV2: <Result = {}, Input = {}>(obj: Input) => Result;
export { objectKeysToSnakeCaseV2 };
export default objectKeysToSnakeCaseV2;