Comparing version 0.8.50 to 0.8.51
@@ -14,2 +14,21 @@ 'use strict'; | ||
/** | ||
* @desc: 进行bigint转换. | ||
*/ | ||
exports.bigint = | ||
function(v) { | ||
if (exports.bigint_check(v)) { | ||
if (typeof v === 'string') { | ||
if (v.length >= 15) // 对千亿以上的数值使用bignumber. | ||
return new BigNumber(v); | ||
return Number(v); | ||
} else { | ||
return v; | ||
} | ||
} | ||
else { | ||
return Number.NaN; | ||
} | ||
} | ||
/** | ||
* @desc: 判断是否是bigint. | ||
@@ -24,3 +43,4 @@ */ | ||
if (typeof v === 'string') | ||
var typev = typeof v; | ||
if (typev === 'string') | ||
{ | ||
@@ -45,2 +65,5 @@ if (v.length > 22 || v.length < 1) | ||
} | ||
else if (typev === 'object') { | ||
return !!v.isBigNumber; | ||
} | ||
else { | ||
@@ -47,0 +70,0 @@ return false; |
@@ -0,4 +1,6 @@ | ||
// Type definitions for febs | ||
/// <reference types="node" /> | ||
/// <reference path="bignumber.js/bignumber.d.ts" /> | ||
@@ -207,2 +209,6 @@ | ||
/** | ||
* @desc: 进行bigint类型转换. | ||
*/ | ||
function bigint(v: any): number|BigNumber; | ||
/** | ||
* @desc: 判断是否是bigint. | ||
@@ -209,0 +215,0 @@ */ |
@@ -86,3 +86,3 @@ { | ||
"name": "febs", | ||
"version": "0.8.50" | ||
"version": "0.8.51" | ||
} |
@@ -5,2 +5,3 @@ // Type definitions for febs | ||
/// <reference path="../browser/types/index.d.ts" /> | ||
/// <reference path="bignumber.js/bignumber.d.ts" /> | ||
@@ -125,2 +126,6 @@ declare global { | ||
/** | ||
* @desc: 进行bigint类型转换. | ||
*/ | ||
function bigint(v: any): number|BigNumber; | ||
/** | ||
* @desc: 判断是否是bigint. | ||
@@ -127,0 +132,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
4603221
79
46107
3