Skip to content

Commit

Permalink
fix(evasive-transform): Do not use ?? nor ?. operators
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Dec 19, 2023
1 parent 94ecf79 commit aaacdd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/evasive-transform/src/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const { default: generator } = /** @type {any} */ (babelGenerate);
export const generate =
/** @type {GenerateAstWithSourceMap & GenerateAstWithoutSourceMap} */ (
(ast, options) => {
const sourceUrl = options?.sourceUrl;
const sourceUrl = options ? options.sourceUrl : undefined;
const result = generator(ast, {
sourceFileName: sourceUrl,
sourceMaps: Boolean(sourceUrl),
Expand Down
5 changes: 4 additions & 1 deletion packages/evasive-transform/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ import { generate } from './generate.js';
* @public
*/
export async function evadeCensor(source, options) {
const { sourceMap, sourceUrl, useLocationUnmap, sourceType } = options ?? {};
// We prefer to use ?? over || here, but we have razed the use of an old ESM
// emulation from our dependent packages graph
// https://www.npmjs.com/package/esm.
const { sourceMap, sourceUrl, useLocationUnmap, sourceType } = options || {};

// See "Chesterton's Fence"
await null;
Expand Down

0 comments on commit aaacdd4

Please sign in to comment.