code: function interpolate(table, skey, sval, tkey) {
  	var range = lookup(table, skey, sval);
  
  	// Note: the lookup table ALWAYS contains at least 2 items (min and max)
  	var prev = !range.lo ? table[0] : !range.hi ? table[table.length - 2] : range.lo;
  	var next = !range.lo ? table[1] : !range.hi ? table[table.length - 1] : range.hi;
  
  	var span = next[skey] - prev[skey];
  	var ratio = span ? (sval - prev[skey]) / span : 0;
  	var offset = (next[tkey] - prev[tkey]) * ratio;
  
  	return prev[tkey] + offset;
  }
docs: Linearly interpolates the given source `value` using the table items `skey` values and
  returns the associated `tkey` value. For example, interpolate(table, 'time', 42, 'pos')
  returns the position for a timestamp equal to 42. If value is out of bounds, values at
  index [0, 1] or [n - 1, n] are used for the interpolation.