/** * Apply args to the `console[method]` & Add a date stamp. * Bind `this` to an object with the following options: * * @param {String} args.date The color string to use for the date * @param {String} args.method The `console` method to use * @param {String} args.custom The custom styling to append to args */ function stamp() { let i = 0; const args = new Array(arguments.length); // i is always valid index for (; i < args.length; ++i) { args[i] = arguments[i]; } // print the curr time. process.stdout.write(clorox[this.color](getTime()) + ' '); // apply arguments to `console` method console[this.method].apply(console, (this.custom ? [this.custom].concat(args) : args)); }
/** * Apply args to the `console[method]` & Add a date stamp. * Bind `this` to an object with the following options: * * @param {String} args.date The color string to use for the date * @param {String} args.method The `console` method to use * @param {String} args.custom The custom styling to append to args */ function stamp() { let i = 0; const args = new Array(arguments.length); // i is always valid index for (; i < args.length; ++i) { args[i] = arguments[i]; } // print the curr time. process.stdout.write(clorox[this.color](getTime()) + ' '); // apply arguments to `console` method console[this.method].apply(console, (this.custom ? [this.custom].concat(args) : args)); }