Here you can find the source of snap(resolution)
Number.prototype.snap = function(resolution) { return Math.floor(this / resolution) * resolution; };
Number.prototype.setInRange = function setInRange(lower, upper){ if (typeof lower === "undefined" || lower === null){ lower = this; if (typeof upper === "undefined" || upper === null){ upper = this; lower = parseFloat(lower) || 0; upper = parseFloat(upper) || 0; ...
'use strict' Number.prototype.sigFig = function(precision){ if( !precision ) precision = 2; var d = Math.pow(10, precision); return ( parseInt( this.valueOf() * d) / d ).toFixed(precision); };
DEFAULT_DIGIT = 5; Number.prototype.simEq = function(number, digits) { digits = digits == undefined ? DEFAULT_DIGIT : digits; var n1 = this.toFixed(digits); var n2 = number.toFixed(digits); if (n1 == -0) n1 = 0; if (n2 == -0) n2 = 0; ...
Number.prototype.sin = function() { return Math.sin(this);
Number.prototype.smallerThan = function(num) { return this < num;
Number.prototype.sqrt = function() { return Math.sqrt(this); };
var expect = chai.expect; Number.prototype.square = function () { "use strict"; return this * this; };
Number.prototype.square = function() { return this * this; };
Number.prototype.step = function (to, add_remove_step) { var from = this.valueOf(); var ch = add_remove_step.match(/[\+,\-]/g)[0]; var i = from; var arr = []; if (ch === '+') { while (i <= to) { arr.push(i); i = i + parseInt(add_remove_step); ...