lib/time_traveler.js
function TimeTraveler(settings) {

  // coerce the +starts_at+ value into a moment
  var starts_at_moment = moment(settings.starts_at);

  // initialize new TimeTraveler object attributes
  this.starts_at = starts_at_moment;
  this.steps = settings.steps;
  this.time_units = settings.time_units;
  this.time_scale = settings.time_scale || 1;
  this.current = { time: starts_at_moment, step: 0 };
}
function TimeTraveler(settings) {

  // coerce the +starts_at+ value into a moment
  var starts_at_moment = moment(settings.starts_at);

  // initialize new TimeTraveler object attributes
  this.starts_at = starts_at_moment;
  this.steps = settings.steps;
  this.time_units = settings.time_units;
  this.time_scale = settings.time_scale || 1;
  this.current = { time: starts_at_moment, step: 0 };
}
function TimeTraveler ( settings ) { // coerce the +starts_at+ value into a moment var starts_at_moment = moment ( settings . starts_at ) ; // initialize new TimeTraveler object attributes this . starts_at = starts_at_moment ; this . steps = settings . steps ; this . time_units = settings . time_units ; this . time_scale = settings . time_scale || 1 ; this . current = { time : starts_at_moment , step : 0 } ; }
Encapsulates helper functions and attributes to create and step
through time series data.

@example
var settings = { starts_at: "2016-10-31", steps: 100, time_units: "days", time_scale: 10 };
var TimeTraveler = require('discrete-time').traveler;
var traveler = new TimeTraveler(settings);

// send the TimeTraveler on their journey!
traveler.run(function(dt){ console.log('hello world'); });  // outputs "hello world" 100 times
@constructor
@param {Object} settings
@param {(moment|string)} settings.starts_at - Sets the starting point for the time series
@param {integer} settings.steps - The total number of intervals in the time series
@param {integer} [settings.time_scale=1] - The number of time units per interval in the time series.
@param {string} settings.time_units - The units of time to use for the time series.

@property {moment} starts_at - Moment.js representation of the start time
@property {integer} steps - Total number of intervals in the time series
@property {string} time_units - The units of time for each time series interval
@property {integer} time_scale - The number of time units per time series interval
@property {object} current - Tracks the current state of the TimeTraveler object
@property {moment} current.time - The current moment the TimeTraveler is at
@property {integer} current.step - The current step the TimeTraveler is at
Encapsulates helper functions and attributes to create and step through time series data .