* 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)
| 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? |
no outgoing calls
no test coverage detected
searching dependent graphs…