index.js
function toDelete(datetimes, options) {

  // We can't just a function like _.difference, because moment objects can't be compared that simply
  // and the incoming values might not already be moment objects
  var seenSurvivors = {};
  toKeep(datetimes, options).map(function (dt) {
    seenSurvivors[dt.toISOString()] = true;
  })

  datetimes = datetimes.map(function (dt) { return moment.utc(dt) });

  // The dates to delete are the ones not returned by toKeep
  return _.filter(datetimes, function (dt) { return !seenSurvivors[ dt.toISOString() ] });

}
function toDelete(datetimes, options) {

  // We can't just a function like _.difference, because moment objects can't be compared that simply
  // and the incoming values might not already be moment objects
  var seenSurvivors = {};
  toKeep(datetimes, options).map(function (dt) {
    seenSurvivors[dt.toISOString()] = true;
  })

  datetimes = datetimes.map(function (dt) { return moment.utc(dt) });

  // The dates to delete are the ones not returned by toKeep
  return _.filter(datetimes, function (dt) { return !seenSurvivors[ dt.toISOString() ] });

}
function toDelete ( datetimes , options ) { // We can't just a function like _.difference, because moment objects can't be compared that simply // and the incoming values might not already be moment objects var seenSurvivors = { } ; toKeep ( datetimes , options ) . map ( function ( dt ) { seenSurvivors [ dt . toISOString ( ) ] = true ; } ) datetimes = datetimes . map ( function ( dt ) { return moment . utc ( dt ) } ) ; // The dates to delete are the ones not returned by toKeep return _ . filter ( datetimes , function ( dt ) { return ! seenSurvivors [ dt . toISOString ( ) ] } ) ; }
Return a set of datetimes that should be deleted, out of 'datetimes`
Return a set of datetimes that should be deleted out of datetimes