Skip to content

Instantly share code, notes, and snippets.

@mientjan
Created January 21, 2016 14:18
Show Gist options
  • Save mientjan/324de27b67be359165ce to your computer and use it in GitHub Desktop.
Save mientjan/324de27b67be359165ce to your computer and use it in GitHub Desktop.
var v = '00:05:19 00:08:13 00:09:19 00:10:23 00:12:02 00:13:06 00:13:19 00:14:11 00:15:10 00:16:17 00:18:03 00:20:06 00:21:09 00:22:03 00:23:09 00:23:20 00:24:19 00:26:03 00:27:19 00:28:15 00:29:23 00:30:21 00:31:21 00:34:07 00:36:11 00:37:18 00:39:12 00:40:19 00:42:12 00:45:22 00:46:19';
var events = {}
var prev = 0;
var curr = 0;
v.split(' ').forEach((value, index) => {
curr = timeToFloat(value)
if(index>0){
events['moment_' + index] = [prev, curr]
}
prev = curr;
});
console.log(JSON.stringify(events))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment