Commit 3f23934d authored by Sean Hammond's avatar Sean Hammond

Simplify some code

parent f32769d5
......@@ -121,15 +121,12 @@ var BREAKPOINTS = [
function getBreakpoint(date, now) {
var breakpoint;
for (var i = 0; i < BREAKPOINTS.length; i++) {
if (BREAKPOINTS[i].test(date, now)) {
breakpoint = BREAKPOINTS[i];
break;
breakpoint = BREAKPOINTS[i];
if (breakpoint.test(date, now)) {
return breakpoint;
}
}
return breakpoint;
}
function nextFuzzyUpdate(date) {
......@@ -195,11 +192,7 @@ function toFuzzyString(date) {
}
var now = new Date();
var breakpoint = getBreakpoint(date, now);
if (!breakpoint) {
return '';
}
return breakpoint.format(new Date(date), now);
return getBreakpoint(date, now).format(new Date(date), now);
}
module.exports = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment