MCPcopy
hub / github.com/tdewolff/minify / isDurationValid

Function isDurationValid

_benchmarks/sample_moment.js:3181–3210  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

3179 ];
3180
3181 function isDurationValid(m) {
3182 var key,
3183 unitHasDecimal = false,
3184 i,
3185 orderLen = ordering.length;
3186 for (key in m) {
3187 if (
3188 hasOwnProp(m, key) &&
3189 !(
3190 indexOf.call(ordering, key) !== -1 &&
3191 (m[key] == null || !isNaN(m[key]))
3192 )
3193 ) {
3194 return false;
3195 }
3196 }
3197
3198 for (i = 0; i < orderLen; ++i) {
3199 if (m[ordering[i]]) {
3200 if (unitHasDecimal) {
3201 return false; // only allow non-integers for smallest unit
3202 }
3203 if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
3204 unitHasDecimal = true;
3205 }
3206 }
3207 }
3208
3209 return true;
3210 }
3211
3212 function isValid$1() {
3213 return this._isValid;

Callers 1

DurationFunction · 0.85

Calls 3

isNaNFunction · 0.85
hasOwnPropFunction · 0.70
toIntFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…