Skip to content

Instantly share code, notes, and snippets.

@idmontie
Created April 24, 2015 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idmontie/0ea277d2abf724fb5725 to your computer and use it in GitHub Desktop.
Save idmontie/0ea277d2abf724fb5725 to your computer and use it in GitHub Desktop.
TODO By for JavaScript
// Inspired by https://github.com/andyw8/do_by
// Usage:
// TODO( 'Finish this feature', 'Decemeber 25, 2015' );
// TODO( 'Finish this feature', '12/15/2015' );
this.TODO = function () {
var message = arguments[0];
var date = arguments[1] || false;
// TODO only set the hours to zero if no time is provided in the TODO
if ( new Date( Date.parse( date ) ) < ( new Date() ).setHours( 0, 0, 0, 0 ) ) {
throw new Error( message + ' is past due! Should have been completed by ' + date );
}
}
@idmontie
Copy link
Author

Should be able to easily make this an NPM and Meteor package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment