Skip to content

Commit

Permalink
fix(packages/remark-lint-fenced-code-flag-case): use better existence…
Browse files Browse the repository at this point in the history
… guarantee for options object
  • Loading branch information
Xunnamius committed Oct 29, 2022
1 parent f368548 commit 955c4f4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/remark-lint-fenced-code-flag-case/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ const remarkLintFencedCodeFlagCase = createLintRule(
origin,
url: 'https://github.com/Xunnamius/unified-utils/tree/main/packages/remark-lint-fenced-code-flag-case#readme'
},
function (tree, file, options = {}) {
if (!options || (typeof options == 'object' && !Array.isArray(options))) {
function (tree, file, options) {
options = options || {};

if (!!options && typeof options == 'object' && !Array.isArray(options)) {
const expectedCase =
// @ts-expect-error: works in [email protected]
('case' in options ? options.case : 'lower') as NonNullable<Options['case']>;
Expand Down

0 comments on commit 955c4f4

Please sign in to comment.