@cdjs/js-math
Advanced tools
Sorry, the diff of this file is not supported yet
@@ -24,3 +24,2 @@ /*! ***************************************************************************** | ||
| var isUndefined = function (u) { return u === void 0; }; | ||
| var JSMath = /** @class */ (function () { | ||
@@ -254,11 +253,12 @@ function JSMath() { | ||
| if (this.isChain) { | ||
| this.result = Math.round(this.multiply(base).result); | ||
| var int = this.multiply(base); | ||
| this.result = Math.round(int.result); | ||
| return this.devide(base); | ||
| } | ||
| else { | ||
| if (isUndefined(float)) { | ||
| console.warn('round function should has two arguments but got one'); | ||
| if (typeof float === 'number') { | ||
| return this.devide(Math.round(this._multiply(base, float)), base); | ||
| } | ||
| else { | ||
| return this.devide(Math.round(this._multiply(base, float)), base); | ||
| console.warn('round function should has two arguments but got one'); | ||
| } | ||
@@ -265,0 +265,0 @@ } |
+5
-5
@@ -30,3 +30,2 @@ (function (global, factory) { | ||
| var isUndefined = function (u) { return u === void 0; }; | ||
| var JSMath = /** @class */ (function () { | ||
@@ -260,11 +259,12 @@ function JSMath() { | ||
| if (this.isChain) { | ||
| this.result = Math.round(this.multiply(base).result); | ||
| var int = this.multiply(base); | ||
| this.result = Math.round(int.result); | ||
| return this.devide(base); | ||
| } | ||
| else { | ||
| if (isUndefined(float)) { | ||
| console.warn('round function should has two arguments but got one'); | ||
| if (typeof float === 'number') { | ||
| return this.devide(Math.round(this._multiply(base, float)), base); | ||
| } | ||
| else { | ||
| return this.devide(Math.round(this._multiply(base, float)), base); | ||
| console.warn('round function should has two arguments but got one'); | ||
| } | ||
@@ -271,0 +271,0 @@ } |
+4
-3
| { | ||
| "name": "@cdjs/js-math", | ||
| "version": "0.0.5", | ||
| "version": "0.0.6", | ||
| "description": "A simple math calculation library for JavaScript and Node.js", | ||
@@ -12,3 +12,3 @@ "main": "dist/bundle.js", | ||
| "scripts": { | ||
| "build": "rollup --config rollup.config.js", | ||
| "build": "tsc && rollup --config rollup.config.js", | ||
| "test": "jest" | ||
@@ -30,2 +30,4 @@ }, | ||
| "eslint": "^6.8.0", | ||
| "eslint-config-prettier": "^6.11.0", | ||
| "eslint-plugin-prettier": "^3.1.4", | ||
| "jest": "^24.9.0", | ||
@@ -35,3 +37,2 @@ "prettier": "^1.19.1", | ||
| "ts-jest": "^24.2.0", | ||
| "ts-loader": "^6.2.1", | ||
| "tslib": "^1.10.0", | ||
@@ -38,0 +39,0 @@ "typescript": "^3.7.3" |
@@ -41,3 +41,3 @@ declare class JSMath { | ||
| */ | ||
| chain(init?: number): this; | ||
| chain(init?: number): JSMath; | ||
| /** | ||
@@ -64,3 +64,3 @@ * 结束链式调用并返回最终值 | ||
| */ | ||
| multiply(...rest: number[]): any; | ||
| multiply(...rest: number[]): number | JSMath; | ||
| /** | ||
@@ -77,3 +77,3 @@ * 实现加的链式调用 | ||
| */ | ||
| add(...rest: number[]): any; | ||
| add(...rest: number[]): number | JSMath; | ||
| /** | ||
@@ -90,3 +90,3 @@ * 实现减的链式调用 | ||
| */ | ||
| subtract(...rest: number[]): any; | ||
| subtract(...rest: number[]): number | JSMath; | ||
| /** | ||
@@ -103,3 +103,3 @@ * 实现除的链式调用 | ||
| */ | ||
| devide(...rest: number[]): any; | ||
| devide(...rest: number[]): number | JSMath; | ||
| /** | ||
@@ -110,4 +110,4 @@ * 四舍五入 | ||
| */ | ||
| round(ratio?: number, float?: number): any; | ||
| round(ratio?: number, float?: number): JSMath | void | number; | ||
| } | ||
| export default JSMath; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24902
0.45%7
16.67%0
-100%13
8.33%