Skip to content

Instantly share code, notes, and snippets.

View xavierchia's full-sized avatar

Xavier Chia xavierchia

View GitHub Profile
// This is a variant on the toFixed method on accountingJS using string manipulation instead of exponential form
var toFixed = lib.toFixed = function (value, precision) {
precision = checkPrecision(precision, lib.settings.number.precision);
// Using exponentialForm
// var exponentialForm = Number(lib.unformat(value) + 'e' + precision);
// var rounded = Math.round(exponentialForm);
// var finalResult = Number(rounded + 'e-' + precision).toFixed(precision);
// return finalResult;
<script src="simpletest.js"></script>
<script>
/*
The function isPrototypeOf should work just like Object.prototype.isPrototypeOf
Syntax:
Formula: isPrototypeOf(parentObject, childObject)
Arguments:
<script src="simpletest.js"></script>
<script>
/*
The librarySystem should be able to store libraries with dependencies and return the library if called
Syntax:
Formula: librarySystem(libraryName, dependencyArray, callbackLibrary)
Arguments:
<script src="simpletest.js"></script>
<script>
/*
The librarySystem should be able to store libraries with dependencies and return the library if called
Syntax:
Formula: librarySystem(libraryName, dependencyArray, callbackLibrary)
Arguments:
<script src="simpletest.js"></script>
<script>
/*
The runWithDebugger function should run a callback with a debugger
Syntax:
Formula: runWithDebugger(callback, [callbackArguments])
Arguments: