MCPcopy Create free account
hub / github.com/flyfloor/react-component / validateUnitByMax

Function validateUnitByMax

component/util/time.js:33–39  ·  view source on GitHub ↗
(value, max)

Source from the content-addressed store, hash-verified

31};
32
33const validateUnitByMax = (value, max) => {
34 value = String(parseInt(value));
35 if (value > max) value = String(Math.floor(value % (max + 1)));
36 if (isNaN(value) || value < 0) value = '00';
37 if (value.length === 1) value = `0${value}`;
38 return value;
39};
40
41module.exports = { timeStr2Obj };

Callers 1

timeStr2ObjFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…