Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

gravlax

Package Overview
Dependencies
0
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.12.5 to 0.12.6

21

lib/interpreter.js

@@ -31,2 +31,5 @@ import { LoxCallable } from "./callable.js";

}
function getNumber(val) {
return isCurrency(val) ? val.value : val;
}
function assertUnreachable(x) {

@@ -75,4 +78,18 @@ throw new Error(`Unreachable code reached! ${x}`);

checkNumberOrCurrencyOperand(operator, left);
checkNumberOperand(operator, right);
return applyToNumOrCurrency(left, (v) => v * right);
checkNumberOrCurrencyOperand(operator, right);
const curR = isCurrency(right);
const value = getNumber(left) * getNumber(right);
if (isCurrency(left)) {
if (curR) {
throw new RuntimeError(operator, "Cannot multiply two currencies.");
} else {
return { currency: left.currency, value };
}
} else {
if (curR) {
return { currency: right.currency, value };
} else {
return value;
}
}
case "+":

@@ -79,0 +96,0 @@ if (typeof left === "string" && typeof right === "string") {

2

package.json
{
"name": "gravlax",
"version": "0.12.5",
"version": "0.12.6",
"description": "A Lox interpreter with tasty TypeScript seasoning",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc