<commit_before>'use strict';

// Dependencies.
import interact from 'interact.js';

function snapGrid (coordinates) {
  return [
    interact.createSnapGrid(coordinates)
  ];
}

export default {
  create: function (width, height, steps) {
    return snapGrid({
      x: width / steps,
      y: height
    });
  }
};<commit_msg>Function to allow rounding timestamps to grid.<commit_after>'use strict';

// Dependencies.
import interact from 'interact.js';

function snapGrid (coordinates) {
  return [
    interact.createSnapGrid(coordinates)
  ];
}

export default {
  create: function (width, height, steps) {
    return snapGrid({
      x: width / steps,
      y: height
    });
  },
  round: function (timestamp, duration, steps) {
    var size = duration / steps;
    var offset = timestamp % size;
    var rounded = timestamp - offset;

    return offset > (size / 2) ? rounded + size : rounded;
  }
};
{'fraction_non_alphanumeric': 0.12127894156560089, 'fraction_numerical': 0.0011025358324145535, 'mean_word_length': 3.071748878923767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '876395', 'n_tokens_mistral': 280, 'n_tokens_neox': 276, 'n_words': 82}