Skip to content

Commit

Permalink
revert to es5
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiansandqvist committed May 24, 2016
1 parent 1a9376a commit 213c72d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 69 deletions.
5 changes: 4 additions & 1 deletion etc/.eslint.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "@seabass"
"extends": "@seabass",
"rules": {
"no-var": 0
}
}
61 changes: 0 additions & 61 deletions etc/.jscs.json

This file was deleted.

10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
'use strict';

function format(diff, divisor, unit, prev) {
const val = Math.floor(diff / divisor);
return val <= 1 ? prev : `${val} ${unit}s ago`;
var val = Math.floor(diff / divisor);
return val <= 1 ? prev : val + ' ' + unit + 's ago';
}

function ago(date) {

const diff = Math.abs(Date.now() - date.getTime());
let units = ago.units;
var diff = Math.abs(Date.now() - date.getTime());
var units = ago.units;

if (diff < 60000) { // less than a minute
return 'just now';
}

for (let i = 0; i < units.length; i++) {
for (var i = 0; i < units.length; i++) {
if (diff < units[i].max) {
return format(diff, units[i].value, units[i].name, units[i].prev);
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "s-ago",
"version": "1.0.6",
"version": "1.1.0",
"description": "Human readable relative times (eg. 4 minutes ago)",
"main": "index.js",
"directories": {
Expand All @@ -9,7 +9,7 @@
"scripts": {
"coverage": "istanbul cover node_modules/mocha/bin/_mocha -dir etc --report lcovonly -- test/ -R spec",
"postcoverage": "rm etc/coverage.json",
"lint": "jscs index.js --config=./etc/.jscs.json && eslint index.js -c etc/.eslint.json",
"lint": "eslint index.js -c etc/.eslint.json",
"postlint": "npm run coverage",
"test": "mocha",
"posttest": "npm run lint"
Expand Down

0 comments on commit 213c72d

Please sign in to comment.