aboutsummaryrefslogtreecommitdiffstats
path: root/src/transpile_js.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transpile_js.rs')
-rw-r--r--src/transpile_js.rs32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/transpile_js.rs b/src/transpile_js.rs
index 97eff68..586abc1 100644
--- a/src/transpile_js.rs
+++ b/src/transpile_js.rs
@@ -40,11 +40,12 @@ impl TranspileJS for ModelicaModel {
let mut args: Vec<String> = self.get_free_vars().iter().map(|s| s.clone()).collect();
args.sort();
args.extend(params);
- Ok(format!(r#"function ({args}) {{
- {constants}
- {binds}
- return [{outputs}];
- }};"#,
+ Ok(format!(
+r#"function ({args}) {{
+ {constants}
+ {binds}
+ return [{outputs}];
+}};"#,
args = args.join(", "),
constants = constants.join("\n "),
binds = binds.join("\n "),
@@ -83,18 +84,19 @@ impl TranspileJSODE for ModelicaModel {
}
let mut args: Vec<String> = self.get_free_vars().iter().map(|s| s.clone()).collect();
args.sort();
- Ok(format!(r#"function ({params}) {{
- return function({args}) {{
- {constants}
- return [
- {expressions}
- ];
- }};
- }};"#,
+ Ok(format!(
+r#"function ({params}) {{
+ return function({args}) {{
+ {constants}
+ return [
+ {expressions}
+ ];
+ }};
+}};"#,
params = params.join(", "),
args = args.join(", "),
- constants = constants.join("\n "),
- expressions = exprs.join(",\n ")))
+ constants = constants.join("\n "), // NB: whitespace
+ expressions = exprs.join(",\n "))) // NB: whitespace
}
}