Skip to content

Commit

Permalink
add eslint to precommit hook; put repo into compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
bignimbus committed Nov 25, 2015
1 parent 3f53f21 commit 3536a46
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-git');
grunt.registerTask('build', ['babel', 'requirejs:main', 'requirejs:lite', 'uglify']);
grunt.registerTask('test', ['build', 'jasmine']);
grunt.registerTask('precommit', [/*'eslint', */ 'test', 'gitadd']);
grunt.registerTask('precommit', ['eslint', 'test', 'gitadd']);
};
4 changes: 2 additions & 2 deletions dist/cash-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ polyfills = function (exports) {
return to;
}
});
}
} /* eslint-enable */
return exports;
}(polyfills);
currencies = function (exports) {
Expand Down Expand Up @@ -528,7 +528,7 @@ cashex = function (exports) {
inferCurrency: {
value: function inferCurrency() {
var _this = this;
var index = undefined, match = undefined, regex = undefined, found = undefined, candidate = undefined, currentCandidate = undefined, currencies = [].concat(this.register.getPrefixes(), this.register.getSuffixes(), this.register.specialMagnitudes);
var index = undefined, match = undefined, regex = undefined, found = undefined, currentCandidate = undefined, currencies = [].concat(this.register.getPrefixes(), this.register.getSuffixes(), this.register.specialMagnitudes);
currencies = '(?:' + currencies.join('|') + ')';
regex = new RegExp(currencies, 'i');
match = this.raw.match(regex)[0];
Expand Down
6 changes: 3 additions & 3 deletions dist/cash.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ polyfills = function (exports) {
return to;
}
});
}
} /* eslint-enable */
return exports;
}(polyfills);
currencies = function (exports) {
Expand Down Expand Up @@ -528,7 +528,7 @@ cashex = function (exports) {
inferCurrency: {
value: function inferCurrency() {
var _this = this;
var index = undefined, match = undefined, regex = undefined, found = undefined, candidate = undefined, currentCandidate = undefined, currencies = [].concat(this.register.getPrefixes(), this.register.getSuffixes(), this.register.specialMagnitudes);
var index = undefined, match = undefined, regex = undefined, found = undefined, currentCandidate = undefined, currencies = [].concat(this.register.getPrefixes(), this.register.getSuffixes(), this.register.specialMagnitudes);
currencies = '(?:' + currencies.join('|') + ')';
regex = new RegExp(currencies, 'i');
match = this.raw.match(regex)[0];
Expand Down Expand Up @@ -833,7 +833,7 @@ cash_dom = function (exports, _cashMain) {
}, {
recalculate: {
value: function recalculate(source, targets) {
var obj = undefined, rate = undefined, current = undefined, oldRate = undefined, multiplier = undefined, cache = this.register.metadata;
var cache = this.register.metadata;
for (var id in cache) {
if (targets && targets.indexOf(cache[id].currency) === -1) {
continue;
Expand Down
7 changes: 1 addition & 6 deletions es5-amd/cash-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,7 @@ define(["exports", "module", "cash-main"], function (exports, module, _cashMain)
}, {
recalculate: {
value: function recalculate(source, targets) {
var obj = undefined,
rate = undefined,
current = undefined,
oldRate = undefined,
multiplier = undefined,
cache = this.register.metadata;
var cache = this.register.metadata;

for (var id in cache) {
if (targets && targets.indexOf(cache[id].currency) === -1) {
Expand Down
1 change: 0 additions & 1 deletion es5-amd/cashex.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ define(["exports", "module"], function (exports, module) {
match = undefined,
regex = undefined,
found = undefined,
candidate = undefined,
currentCandidate = undefined,
currencies = [].concat(this.register.getPrefixes(), this.register.getSuffixes(), this.register.specialMagnitudes);
currencies = "(?:" + currencies.join("|") + ")";
Expand Down
4 changes: 4 additions & 0 deletions es5-amd/polyfills.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
define(["exports"], function (exports) {
// source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

/* eslint-disable */
"use strict";

if (!Object.assign) {
Expand Down Expand Up @@ -33,4 +35,6 @@ define(["exports"], function (exports) {
}
});
}

/* eslint-enable */
});
11 changes: 3 additions & 8 deletions src/cash-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export default class CashDom extends Cash {
throw new Error(`${currency} not supported.`);
}
});
this.for = (targets, source) => {
this.for = ((targets, source) => {
this.constructor.recalculate.call(this, source, targets);
}.bind(this, currencies);
}).bind(this, currencies);
return this;
}

Expand All @@ -49,12 +49,7 @@ export default class CashDom extends Cash {
}

static recalculate (source, targets) {
let obj,
rate,
current,
oldRate,
multiplier,
cache = this.register.metadata;
let cache = this.register.metadata;

for (let id in cache) {
if (targets && targets.indexOf(cache[id].currency) === -1) {
Expand Down
1 change: 0 additions & 1 deletion src/cashex.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export default class CashEx {
match,
regex,
found,
candidate,
currentCandidate,
currencies = [].concat(this.register.getPrefixes(), this.register.getSuffixes(), this.register.specialMagnitudes);
currencies = `(?:${currencies.join('|')})`;
Expand Down
4 changes: 4 additions & 0 deletions src/polyfills.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

/* eslint-disable */
if (!Object.assign) {
Object.defineProperty(Object, 'assign', {
enumerable: false,
Expand Down Expand Up @@ -30,3 +32,5 @@ if (!Object.assign) {
}
});
}

/* eslint-enable */
4 changes: 1 addition & 3 deletions tests/currencies.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
dollarSign = ['$'],
usd = ['USD'],
bucks = ['bucks'],
one = ['one'],
a = ['a'],
dollars = ['dollars'],
nums = ['12345'],
decimals = ['.50'];
Expand Down Expand Up @@ -307,4 +305,4 @@
expect(cashCount(processed)).toBe(8);
});
});
})();
})();
5 changes: 0 additions & 5 deletions tests/main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@
});

describe('tag', function () {
function cashCount (str) {
var match = str.match(/\/span/g);
return match ? match.length : 0;
}

beforeEach(function () {
cash = new Cash();
});
Expand Down

0 comments on commit 3536a46

Please sign in to comment.