Skip to content

Commit

Permalink
Merge pull request #111 from josemarluedke/chore/get-with-default
Browse files Browse the repository at this point in the history
Remove usage of deprecated getWithDefault
  • Loading branch information
josemarluedke committed Oct 26, 2020
2 parents f39c63c + 4f61467 commit 611973c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/notifications/addon/-private/get-config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import config from 'ember-get-config';
import { DefaultConfig } from './types';
import { getWithDefault } from '@ember/object';
import { get } from '@ember/object';

export function getConfigOption<T extends keyof DefaultConfig>(
key: T,
defaultValue: NonNullable<DefaultConfig[T]> | undefined
defaultValue: NonNullable<DefaultConfig[T]>
): NonNullable<DefaultConfig[T]> {
return getWithDefault(
const value = get(
config['@frontile/notifications'] || ({} as never),
key as never,
defaultValue as never
key as never
);

if (value === undefined) {
return defaultValue;
}

return value;
}

0 comments on commit 611973c

Please sign in to comment.