Skip to content

Commit

Permalink
style(xsnap): arrow function, explicit {}
Browse files Browse the repository at this point in the history
Co-authored-by: Mark S. Miller <erights@users.noreply.github.com>
  • Loading branch information
dckc and erights committed Sep 20, 2021
1 parent d8dd20e commit 5ad8e36
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/xsnap/lib/console-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
// implemented using assert.quote from SES.
let quote = _v => '[?]';

function tryPrint(...args) {
const printAll = (...args) => {
// xsnap print() is not known to eslint
// eslint-disable-next-line
print(...args.map(v => typeof v === 'string' ? v : quote(v)));
}
};

const noop = _ => {};

Expand All @@ -21,11 +22,11 @@ const noop = _ => {};
* See https://github.com/Agoric/agoric-sdk/issues/2146
*/
const console = {
debug: tryPrint,
log: tryPrint,
info: tryPrint,
warn: tryPrint,
error: tryPrint,
debug: printAll,
log: printAll,
info: printAll,
warn: printAll,
error: printAll,

trace: noop,
dirxml: noop,
Expand All @@ -52,7 +53,9 @@ const console = {
let quoteSet = false;

export function setQuote(f) {
if (quoteSet) throw TypeError('quote already set');
if (quoteSet) {
throw TypeError('quote already set');
}
quote = f;
quoteSet = true;
}
Expand Down

0 comments on commit 5ad8e36

Please sign in to comment.