MCPcopy Create free account
hub / github.com/apitable/apitable / digitLength

Function digitLength

packages/core/src/utils/number.ts:256–262  ·  view source on GitHub ↗
(num: number)

Source from the content-addressed store, hash-verified

254
255// get the number of digits after the decimal point
256export function digitLength(num: number): number {
257 const eSplit = num.toString().split(/[eE]/);
258 const dLen = (eSplit[0]!.split('.')[1] || '').length;
259 const power = Number(eSplit[1]) || 0;
260 const len = dLen - power;
261 return len > 0 ? len : 0;
262}
263
264// Scale the float to an integer,
265export function float2Fixed(num: number): number {

Callers 6

setEditorValueFunction · 0.90
float2FixedFunction · 0.85
timesFunction · 0.85
divideFunction · 0.85
plusFunction · 0.85
minusFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected