Showing 13 of 23 total issues
File measurement.js
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Measurement.Js
*
* Unit-of-Measure conversion made easy.
Function MeasurementConverter
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function MeasurementConverter(unitType) {
var inputUnit = null,
outputUnit = null,
self = this;
Function exports
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: './',
Function convert
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.convert = function(value) {
if (DEFINITIONS[unitType]) {
var inputDef = DEFINITIONS[unitType][inputUnit],
outputDef = DEFINITIONS[unitType][outputUnit];
Function MeasurementJs
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function MeasurementJs(UnitType) {
var self = this;
/**
*
* @param {type} value
Avoid deeply nested control flow statements. Open
Open
if (baseType === inputDef.base) {
baseValue = mjs(unitType).convert(value).from(inputDef.key).to(inputDef.base);
inputUnit = inputDef.base;
} else if (baseType === outputDef.base) {
baseValue = mjs(unitType).convert(value).from(outputDef.key).to(outputDef.base);
Avoid deeply nested control flow statements. Open
Open
if (baseType === UNIT.Temperature.CELSIUS) {
return parseFloat(self.convert(baseValue).toFixed(10));
}
Avoid deeply nested control flow statements. Open
Open
if (typeof outputDef.factor === 'function') {
return outputDef.factor(value, true);
}
Avoid deeply nested control flow statements. Open
Open
if (typeof baseType === 'undefined') {
return false;
}
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return self.convert(baseValue);
Avoid too many return
statements within this function. Open
Open
return parseFloat(self.convert(baseValue).toFixed(10));
Avoid too many return
statements within this function. Open
Open
return false;