Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Commit

Permalink
fix: remove "dev" property and use throwError directly
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Aug 23, 2020
1 parent 529721e commit f4339e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions src/automapper.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ export class AutomapperModule implements OnModuleInit {
*/
static withMapper(
name?: string,
globalSettings?: AutoMapperGlobalSettings & { dev?: boolean }
): DynamicModule;
static withMapper(
globalSettings?: AutoMapperGlobalSettings & { dev?: boolean }
globalSettings?: AutoMapperGlobalSettings
): DynamicModule;
static withMapper(globalSettings?: AutoMapperGlobalSettings): DynamicModule;
static withMapper(...args: any[]): DynamicModule {
const [name, globalSettings] = getWithMapperArgs(args);
const mapper = new AutoMapper();
if (globalSettings != null) {
globalSettings.throwError =
globalSettings.dev != null ? !globalSettings.dev : undefined;
mapper.withGlobalSettings(globalSettings);
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/getWithMapperArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AutoMapperGlobalSettings } from '@nartc/automapper';

export function getWithMapperArgs(
args: any[]
): [string, (AutoMapperGlobalSettings & { dev?: boolean })?] {
): [string, AutoMapperGlobalSettings?] {
if (!args.length) {
return [''];
}
Expand Down

0 comments on commit f4339e4

Please sign in to comment.