MCPcopy
hub / github.com/IanLunn/Sequence / convertTimeToMs

Function convertTimeToMs

src/sequence.js:431–450  ·  view source on GitHub ↗

* Converts a time value taken from a CSS property, such as "0.5s" * and converts it to a number in milliseconds, such as 500 * * @param {String} time - the time in a string * @returns {Number} convertedTime - the time as a number * @api private

(time)

Source from the content-addressed store, hash-verified

429 * @api private
430 */
431 function convertTimeToMs(time) {
432
433 var convertedTime,
434 fraction;
435
436 // Deal with milliseconds and seconds
437 if (time.indexOf("ms") > -1) {
438 fraction = 1;
439 }else {
440 fraction = 1000;
441 }
442
443 if (time == "0s") {
444 convertedTime = 0;
445 }else {
446 convertedTime = parseFloat(time.replace("s", "")) * fraction;
447 }
448
449 return convertedTime;
450 }
451
452 /**
453 * Does an element have a particular class?

Callers 1

defineSequenceFunction · 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…