UNPKG

iab-vast-parser

Version:

Parses IAB VAST tags into iab-vast-model objects.

17 lines (15 loc) 365 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var re = /^\s*(\d+):(\d+):(\d+(?:\.\d+)?)\s*$/; exports.default = function (str) { if (typeof str !== 'string') { return null; } var m = re.exec(str); if (m == null) { return null; } return (parseInt(m[1], 10) * 60 + parseInt(m[2], 10)) * 60 + parseFloat(m[3]); };