From 1aec9b6479beecd327456780ae7c711040011933 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sat, 28 Jan 2017 21:25:37 -0800 Subject: fiddling with whitespace for other reprs --- src/transpile_js.rs | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src/transpile_js.rs') 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 = 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 = 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 } } -- cgit v1.2.3