Skip to content

Commit

Permalink
fix!: require line property in Bunyan src object
Browse files Browse the repository at this point in the history
This should have been required from the start as per Bunyan specification. It's unlikely to break applications, but still is a breaking change as the behaviour changes.
  • Loading branch information
jdbruijn committed Jun 1, 2023
1 parent 38486f0 commit b219f0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/bunyan/is-source.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const returnsWithout = test.macro<[boolean, keyof Source]>({
},
});

test(returnsWithout, false, 'file');
test(returnsWithout, false, 'line');
test(returnsWithout, true, 'func');

Expand Down
3 changes: 2 additions & 1 deletion src/bunyan/is-source.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import is from '@sindresorhus/is';
import type {Source} from './record.js';
import {type Source} from './record.js';

function isSource(value: unknown): value is Source {
return (
is.plainObject(value) &&
is.string(value.file) &&
is.number(value.line) &&
(is.undefined(value.func) || is.string(value.func))
);
Expand Down

0 comments on commit b219f0b

Please sign in to comment.