Skip to content

Commit

Permalink
feat(core/create): ensures collection has scope on extract
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Oct 16, 2019
1 parent 64e720a commit dcdfddc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/core/src/create/scopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export function extract<T extends CollectionTree, N extends keyof T['scopes']>(
collection: T,
name: N & string
): ExtractCollection<T, N> {
if (!Object.hasOwnProperty.call(collection.scopes, name)) {
throw Error(`Collection doesn't have scope: ${name}`);
}

const { types } = collection;
const { services, scopes } = collection.scopes[name];
return {
Expand Down

0 comments on commit dcdfddc

Please sign in to comment.