Calculate File
The calculate.js file is where all the action happens. The calculate file uses javascript. This is where you write the logic that performs the necessary transformations on your input to create your desired output. The calculate.js file must always return an output object based on the format specified below. The calculate.js file also handles all reporting functions, and returns the report that is generated by your calculator.
#
Layout#
Output Format#
ReporterHelpersReporterHelpers.round()
#
Will round any number to 2 decimal places, or if you provide a second argument it will round to that figure. It will work with strings and handle NaNs without crashing.
#
ExamplesReporterHelpers.convert()
#
Converts units
#
ExamplesReporterHelpers.formula()
#
Will automatically evaluate and print an equation to represent the result.
ReporterHelpers.formula(options)
#
Example#
Output
ReporterHelpers.lineResult()
#
This will create a nice easy and lightweight reporting option. Rather than showing full equations, you might just want to print intermediate results:
ReporterHelpers.formula(description, symbol, value)
Note: You will need to open a REPORT block for this to be visible:
#
Examples#
Output
ReporterHelpers.quickTable()
#
#
Example#
Output
ReporterHelpers.printStatus()
#
This will automatically format a clean colour-based result on the right side of the table. It will automaticall read a value, and if it is > 1 it will show a red FAIL. If it is < 1, it will show a green PASS:

#
Other PackagesThe following packages are also installed on the report by default:
- VariableCollection = calculate.js supports any variable functionality
- ResultsTable - create results tables
- SectionSVG = SVGs can be drawn using SkyCiv Section SVG Package (see dev-docs)
- Graph = (see dev-docs)
- JsToLatex = (see dev-docs)
- calculate = (see dev-docs)