export default function(node, {evaluate, scope}) { const unary = (arg) => { switch (node.operator) { case '+' : return +arg; case '-' : return -arg; case '!' : return !arg; case '~' : return ~arg; case 'typeof': return typeof arg; case 'void' : return undefined; // case 'delete': ... /* v8 ignore next 2 */ default: throw new Error(`operator not implemented: ${node.operator}`); } }; const arg = evaluate(node.argument, {scope}); if (arg.async) { return { async: true, value: Promise.resolve(arg.value).then(unary), }; } return {async: false, value: unary(arg.value)}; }