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

Function validateUnitByMax

lib/util/time.js:41–47  ·  view source on GitHub ↗
(value, max)

Source from the content-addressed store, hash-verified

39};
40
41var validateUnitByMax = function validateUnitByMax(value, max) {
42 value = String(parseInt(value));
43 if (value > max) value = String(Math.floor(value % (max + 1)));
44 if (isNaN(value) || value < 0) value = '00';
45 if (value.length === 1) value = '0' + value;
46 return value;
47};
48
49module.exports = { timeStr2Obj: 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…