@compute.ts/number
Version:
Provide number operators for the computeTS package
1 lines • 2.99 kB
JavaScript
;var __extends=this&&this.__extends||function(){var o=function(r,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])})(r,t)};return function(r,t){function e(){this.constructor=r}o(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}}(),__spreadArrays=this&&this.__spreadArrays||function(){for(var r=0,t=0,e=arguments.length;t<e;t++)r+=arguments[t].length;for(var o=Array(r),n=0,t=0;t<e;t++)for(var u=arguments[t],i=0,p=u.length;i<p;i++,n++)o[n]=u[i];return o};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ComputeNumberNode=void 0;var core_1=require("@compute.ts/core"),ComputeNumberLibrary_1=require("./ComputeNumberLibrary"),ComputeNumberNode=function(o){function n(r,t,e){e=o.call(this,r=void 0===r?[]:r,t,e)||this;return e.fingerprint=n.fingerprint,e}return __extends(n,o),n.leaf=function(r){return new n([],void 0,r)},n.expression=function(r,t){return new n(r=void 0===r?[]:r,t)},n.nodify=function(r){if("number"==typeof r)return n.leaf(r);if(r.fingerprint===n.fingerprint)return r;throw Error("A given value is not a number value or a number expression")},n.prototype.plus=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return ComputeNumberLibrary_1.plus.apply(void 0,__spreadArrays([this],r))},n.prototype.substract=function(r){return this.minus(r)},n.prototype.minus=function(r){return ComputeNumberLibrary_1.minus(this,r)},n.prototype.multiply=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return ComputeNumberLibrary_1.multiply.apply(void 0,__spreadArrays([this],r))},n.prototype.divideBy=function(r){return ComputeNumberLibrary_1.divide(this,r)},n.prototype.modulo=function(r){return ComputeNumberLibrary_1.modulo(this,r)},n.prototype.opposite=function(){return ComputeNumberLibrary_1.opposite(this)},n.prototype.equal=function(r){return ComputeNumberLibrary_1.equal(this,r)},n.prototype.notEqual=function(r){return ComputeNumberLibrary_1.notEqual(this,r)},n.prototype.lessThan=function(r){return ComputeNumberLibrary_1.lessThan(this,r)},n.prototype.lessOrEqualThan=function(r){return ComputeNumberLibrary_1.lessOrEqualThan(this,r)},n.prototype.greaterThan=function(r){return ComputeNumberLibrary_1.greaterThan(this,r)},n.prototype.greaterOrEqualThan=function(r){return ComputeNumberLibrary_1.greaterOrEqualThan(this,r)},n.prototype.isZero=function(){return ComputeNumberLibrary_1.isZero(this)},n.prototype.isPositive=function(){return ComputeNumberLibrary_1.isPositive(this)},n.prototype.isNegative=function(){return ComputeNumberLibrary_1.isNegative(this)},n.prototype.isEven=function(){return ComputeNumberLibrary_1.isEven(this)},n.prototype.isOdd=function(){return ComputeNumberLibrary_1.isOdd(this)},n.prototype.isPrime=function(){return ComputeNumberLibrary_1.isPrime(this)},n.fingerprint="w9z$C&E)",n}(core_1.ComputeApiNode);exports.ComputeNumberNode=ComputeNumberNode;