Skip to content

Commit

Permalink
Merge pull request #3 from humandx/rev/type
Browse files Browse the repository at this point in the history
Update types
  • Loading branch information
vshia authored Oct 11, 2021
2 parents 1edb4ac + 1270b01 commit 5da8cee
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 32 deletions.
60 changes: 29 additions & 31 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,36 @@
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare namespace humps {

function camelize(value: string): string;
function pascalize(value: string): string;
function decamelize(value: string, optionsOrProcessor?: OptionOrProcessor): string;
function depascalize(value: string, optionsOrProcessor?: OptionOrProcessor): string;
declare module "@humandx/humps" {
declare namespace humps {
function camelize(value: string): string;
function pascalize(value: string): string;
function decamelize(value: string, optionsOrProcessor?: OptionOrProcessor): string;
function depascalize(value: string, optionsOrProcessor?: OptionOrProcessor): string;

function camelizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
function pascalizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
function decamelizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
function depascalizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
function camelizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
function pascalizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
function decamelizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
function depascalizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;

function camelizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
function pascalizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
function decamelizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
function depascalizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
function camelizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
function pascalizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
function decamelizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
function depascalizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];

interface HumpsOptions {
separator?: string;
split?: RegExp;
process?: HumpsProcessor;
ignorePrivate?: boolean;
}
interface HumpsProcessor {
(key: string, convert: HumpsProcessorParameter, options?: HumpsOptions): string;
}
interface HumpsProcessorParameter {
(key: string, options?: HumpsOptions): string;
}
type OptionOrProcessor = HumpsOptions | HumpsProcessor;
}

declare module "@humandx/humps" {
export = humps;
interface HumpsOptions {
separator?: string;
split?: RegExp;
process?: HumpsProcessor;
ignorePrivate?: boolean;
}
interface HumpsProcessor {
(key: string, convert: HumpsProcessorParameter, options?: HumpsOptions): string;
}
interface HumpsProcessorParameter {
(key: string, options?: HumpsOptions): string;
}
type OptionOrProcessor = HumpsOptions | HumpsProcessor;
}
export = humps;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@humandx/humps",
"version": "2.0.5",
"version": "2.0.6",
"description": "Underscore-to-camelCase converter (and vice versa) for strings and object keys in JavaScript.",
"main": "humps.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 5da8cee

Please sign in to comment.