Skip to content

Commit

Permalink
Add parser options helper for supplying partial options
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBCarter committed Mar 13, 2024
1 parent 60ec8da commit 91dcd7f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/middleware/jsonBodyParser/jsonBodyParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ export const DefaultJsonBodyParserOptions: OptionsJson = {
type: DefaultJsonBodyParserOptionsTypes,
}

/**
* Gets the default JSON Body Parser options merged with the supplied options
* with the supplied options taking precedence
* @param options The options to override the default JSON Body Parser options with
* @returns The combined JSON Body Parser options with the supplied values taking
* precedence over the default
*/
export const getJsonBodyParserOptions = (options: Partial<OptionsJson>): OptionsJson => {
return { ...DefaultJsonBodyParserOptions, ...options }
}

/**
* Get a JSON Body Parser connect middleware handler
* @param options The options for the JSON Body Parser
Expand Down

0 comments on commit 91dcd7f

Please sign in to comment.