Skip to content

Commit

Permalink
index.js: use nullish coalescing and optional chaining operators (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed May 6, 2023
1 parent 6af1f3f commit 5bc5b41
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ function precinct(content, options = {}) {
}
}

const type = options.type || getModuleType.fromSource(ast);
const type = options.type ?? getModuleType.fromSource(ast);
debug('module type: %s', type);

let detective;
const mixedMode = options.es6 && options.es6.mixedImports;
const mixedMode = options.es6?.mixedImports;

switch (type) {
case 'cjs':
Expand Down Expand Up @@ -131,7 +131,7 @@ function precinct(content, options = {}) {
}

// For non-JS files that we don't parse
if (detective && detective.ast) {
if (detective?.ast) {
precinct.ast = detective.ast;
}

Expand Down

0 comments on commit 5bc5b41

Please sign in to comment.