Skip to content

Commit

Permalink
refactor(utils): generate unique id only if needed
Browse files Browse the repository at this point in the history
Rely on JS short circuit on OR operation to generate the uuid v4 only if the factory key was not provided
  • Loading branch information
micalevisk committed Apr 4, 2022
1 parent 247a8d6 commit 1693f24
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/utils/create-config-factory.util.ts
Expand Up @@ -7,9 +7,8 @@ import { ConfigFactoryKeyHost } from './register-as.util';
export function createConfigProvider(
factory: ConfigFactory & ConfigFactoryKeyHost,
): FactoryProvider {
const uniqId = uuid();
return {
provide: factory.KEY || getConfigToken(uniqId),
provide: factory.KEY || getConfigToken(uuid()),
useFactory: factory,
inject: [],
};
Expand Down

0 comments on commit 1693f24

Please sign in to comment.