Skip to content

Commit

Permalink
fix(core/tasks): fails on tasks starting with "_"
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed May 4, 2019
1 parent dbd6aa9 commit 2439812
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/tasks/from-kpo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export function trunk(arr: string[], obj: any, path: string): ITask {
}

const key = arr.shift() as string;
if (key[0] === '_') {
throw Error(
`Fields starting with '_' are reserved for metadata: ` +
purePath(path ? `${path}.${key}` : key)
);
}
if (typeof obj !== 'object' || obj === null || obj instanceof Error) {
throw Error(`${purePath(path)} is not an object`);
}
Expand Down

0 comments on commit 2439812

Please sign in to comment.