UNPKG

messaging-api-common

Version:

Helpers for common usages in Messaging API clients

124 lines 3.02 kB
import type { Options } from 'map-obj'; declare type PlainObject = Record<string, any>; /** * Converts a string to snake case. * * @param text - The input string * @returns The converted string * * @example * ```js * snakecase('fooBar'); * //=> 'foo_bar' * ``` */ declare function snakecase(text: string): string; /** * Converts object keys to snake case. * * @param obj - The input object * @param options - The options to config this convert function * @returns The converted object * * @example * ```js * snakecaseKeys({ 'fooBar': true }); * //=> { 'foo_bar': true } * ``` */ declare function snakecaseKeys(obj: PlainObject, options?: Options): PlainObject; /** * Converts object keys to snake case deeply. * * @param obj - The input object * @returns The converted object * * @example * ```js * snakecaseKeysDeep({ 'fooBar': { 'barFoo': true } }); * //=> { 'foo_bar': { 'bar_foo': true } } * ``` */ declare function snakecaseKeysDeep(obj: PlainObject): PlainObject; /** * Converts a string to camel case. * * @param text - The input string * @returns The converted string * * @example * ```js * camelcase('foo_bar'); * //=> 'fooBar' * ``` */ declare function camelcase(text: string): string; /** * Converts object keys to camel case. * * @param obj - The input object * @param options - The options to config this convert function * @returns The converted object * * @example * ```js * camelcaseKeys({ 'foo_bar': true }); * //=> { 'fooBar': true } * ``` */ declare function camelcaseKeys(obj: PlainObject, options?: Options): PlainObject; /** * Converts object keys to camel case deeply. * * @param obj - The input object * @returns The converted object * * @example * ```js * camelcaseKeysDeep({ 'foo_bar': { 'bar_foo': true } }); * //=> { 'fooBar': { 'barFoo': true } } * ``` */ declare function camelcaseKeysDeep(obj: PlainObject): PlainObject; /** * Converts a string to pascal case. * * @param text - The input string * @returns The converted string * * @example * ```js * pascalcase('fooBar'); * //=> 'FooBar' * ``` */ declare function pascalcase(str: string): string; /** * Converts object keys to pascal case. * * @param obj - The input object * @param options - The options to config this convert function * @returns The converted object * * @example * ```js * pascalcaseKeys({ 'fooBar': true }); * //=> { 'FooBar': true } * ``` */ declare function pascalcaseKeys(obj: PlainObject, options?: Options): PlainObject; /** * Converts object keys to pascal case deeply. * * @param obj - The input object * @returns The converted object * * @example * ```js * pascalcaseKeysDeep({ 'fooBar': { 'barFoo': true } }); * //=> { 'FooBar': { 'BarFoo': true } } * ``` */ declare function pascalcaseKeysDeep(obj: PlainObject): PlainObject; export { snakecase, snakecaseKeys, snakecaseKeysDeep, camelcase, camelcaseKeys, camelcaseKeysDeep, pascalcase, pascalcaseKeys, pascalcaseKeysDeep, }; //# sourceMappingURL=case.d.ts.map