distance-converter
Advanced tools
Comparing version 0.1.0 to 1.0.0
@@ -75,3 +75,11 @@ module.exports = function(from) { | ||
conversions['in'] = conversions.inches; | ||
conversions.ft = conversions.feet; | ||
conversions.yd = conversions.yards; | ||
conversions.mi = conversions.miles; | ||
conversions.cm = conversions.centimeters; | ||
conversions.m = conversions.meters; | ||
conversions.km = conversions.kilometers; | ||
return conversions; | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "Convert distances between common units of measure", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/nrf110/distance-converter", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -410,2 +410,411 @@ var should = require('should'), | ||
}); | ||
// | ||
//Abbreviated units of Measure | ||
describe('in', function() { | ||
describe('toInches', function() { | ||
it('should return the input value', function() { | ||
var result = convert(1)['in'].toInches(); | ||
result.should.eql(1); | ||
}); | ||
}); | ||
describe('toFeet', function() { | ||
it('should return a value between 0.083 and 0.084', function() { | ||
var result = convert(1)['in'].toFeet(); | ||
result.should.be.within(0.083, 0.084); | ||
}); | ||
}); | ||
describe('toYards', function() { | ||
it('should return a value between 0.027 and 0.028', function() { | ||
var result = convert(1)['in'].toYards(); | ||
result.should.be.within(0.027, 0.028); | ||
}); | ||
}); | ||
describe('toMiles', function() { | ||
it('should return a value between 0.0000157 and 0.0000158', function() { | ||
var result = convert(1)['in'].toMiles(); | ||
result.should.be.within(0.0000157, 0.0000158); | ||
}); | ||
}); | ||
describe('toCentimeters', function() { | ||
it('should return 2.54', function() { | ||
var result = convert(1)['in'].toCentimeters(); | ||
result.should.eql(2.54); | ||
}); | ||
}); | ||
describe('toMeters', function() { | ||
it('should return 0.0254', function() { | ||
var result = convert(1)['in'].toMeters(); | ||
result.should.eql(0.0254); | ||
}); | ||
}); | ||
describe('toKilometers', function() { | ||
it('should return 0.0000254', function() { | ||
var result = convert(1)['in'].toKilometers(); | ||
result.should.eql(0.0000254); | ||
}); | ||
}); | ||
describe('toRadians', function() { | ||
it('should return a value between 2.27e-7 and 2.28e-7', function() { | ||
var result = convert(1)['in'].toRadians(); | ||
result.should.be.within(2.27e-7, 2.28e-7); | ||
}); | ||
}); | ||
}); | ||
describe('ft', function() { | ||
describe('toInches', function() { | ||
it('should return 12', function() { | ||
var result = convert(1).ft.toInches(); | ||
result.should.eql(12); | ||
}); | ||
}); | ||
describe('toFeet', function() { | ||
it('should return the input value', function() { | ||
var result = convert(1).ft.toFeet(); | ||
result.should.eql(1); | ||
}); | ||
}); | ||
describe('toYards', function() { | ||
it('should return a value between 0.33 and 0.34', function() { | ||
var result = convert(1).ft.toYards(); | ||
result.should.be.within(0.033, 0.34); | ||
}); | ||
}); | ||
describe('toMiles', function() { | ||
it('should return a value between 0.000189 and 0.00019', function() { | ||
var result = convert(1).ft.toMiles(); | ||
result.should.be.within(0.000189, 0.00019); | ||
}); | ||
}); | ||
describe('toCentimeters', function() { | ||
it('should return 30.48', function() { | ||
var result = convert(1).ft.toCentimeters(); | ||
result.should.eql(30.48); | ||
}); | ||
}); | ||
describe('toMeters', function() { | ||
it('should return 0.3048', function() { | ||
var result = convert(1).ft.toMeters(); | ||
result.should.eql(0.3048); | ||
}); | ||
}); | ||
describe('toKilometers', function() { | ||
it('should return 0.0003048', function() { | ||
var result = convert(1).ft.toKilometers(); | ||
result.should.eql(0.0003048); | ||
}); | ||
}); | ||
describe('toRadians', function() { | ||
it('should return a value between 2.27e-7 and 2.28e-7', function() { | ||
var result = convert(1).ft.toRadians(); | ||
result.should.be.within(2.7e-6, 2.8e-6); | ||
}); | ||
}); | ||
}); | ||
describe('yd', function() { | ||
describe('toInches', function() { | ||
it('should return 36', function() { | ||
var result = convert(1).yd.toInches(); | ||
result.should.eql(36); | ||
}); | ||
}); | ||
describe('toFeet', function() { | ||
it('should return 3', function() { | ||
var result = convert(1).yd.toFeet(); | ||
result.should.eql(3); | ||
}); | ||
}); | ||
describe('toYards', function() { | ||
it('should return the input value', function() { | ||
var result = convert(1).yd.toYards(); | ||
result.should.eql(1); | ||
}); | ||
}); | ||
describe('toMiles', function() { | ||
it('should return a value between 0.00056 and 0.00057', function() { | ||
var result = convert(1).yd.toMiles(); | ||
result.should.be.within(0.00056, 0.00057); | ||
}); | ||
}); | ||
describe('toCentimeters', function() { | ||
it('should return 91.44', function() { | ||
var result = convert(1).yd.toCentimeters(); | ||
result.should.eql(91.44); | ||
}); | ||
}); | ||
describe('toMeters', function() { | ||
it('should return 0.9144', function() { | ||
var result = convert(1).yd.toMeters(); | ||
result.should.eql(0.9144); | ||
}); | ||
}); | ||
describe('toKilometers', function() { | ||
it('should return 0.0009144', function() { | ||
var result = convert(1).yd.toKilometers(); | ||
result.should.eql(0.0009144); | ||
}); | ||
}); | ||
describe('toRadians', function() { | ||
it('should return a value between 8.2e-6 and 8.3e-6', function() { | ||
var result = convert(1).yd.toRadians(); | ||
result.should.be.within(8.2e-6, 8.3e-6); | ||
}); | ||
}); | ||
}); | ||
describe('mi', function() { | ||
describe('toInches', function() { | ||
it('should return 63360', function() { | ||
var result = convert(1).mi.toInches(); | ||
result.should.eql(63360); | ||
}); | ||
}); | ||
describe('toFeet', function() { | ||
it('should return 5280', function() { | ||
var result = convert(1).mi.toFeet(); | ||
result.should.eql(5280); | ||
}); | ||
}); | ||
describe('toYards', function() { | ||
it('should return 1760', function() { | ||
var result = convert(1).mi.toYards(); | ||
result.should.eql(1760); | ||
}); | ||
}); | ||
describe('toMiles', function() { | ||
it('should return the input value', function() { | ||
var result = convert(1).mi.toMiles(); | ||
result.should.eql(1); | ||
}); | ||
}); | ||
describe('toCentimeters', function() { | ||
it('should return 160934.4', function() { | ||
var result = convert(1).mi.toCentimeters(); | ||
result.should.eql(160934.4); | ||
}); | ||
}); | ||
describe('toMeters', function() { | ||
it('should return 1609.344', function() { | ||
var result = convert(1).mi.toMeters(); | ||
result.should.eql(1609.344); | ||
}); | ||
}); | ||
describe('toKilometers', function() { | ||
it('should return 1.609344', function() { | ||
var result = convert(1).mi.toKilometers(); | ||
result.should.eql(1.609344); | ||
}); | ||
}); | ||
describe('toRadians', function() { | ||
it('should return a value between 0.014 and 0.015', function() { | ||
var result = convert(1).mi.toRadians(); | ||
result.should.be.within(0.014, 0.015); | ||
}); | ||
}); | ||
}); | ||
describe('centimeters', function() { | ||
describe('toInches', function() { | ||
it('should return a value between 0.393 and 0.394', function() { | ||
var result = convert(1).cm.toInches(); | ||
result.should.be.within(0.393, 0.394); | ||
}); | ||
}); | ||
describe('toFeet', function() { | ||
it('should return a value between 0.0328 and 0.0329', function() { | ||
var result = convert(1).cm.toFeet(); | ||
result.should.be.within(0.0328, 0.0329); | ||
}); | ||
}); | ||
describe('toYards', function() { | ||
it('should return a value between 0.01 and 0.011', function() { | ||
var result = convert(1).cm.toYards(); | ||
result.should.be.within(0.01, 0.011); | ||
}); | ||
}); | ||
describe('toMiles', function() { | ||
it('should return a value between 6.21e-6 and 6.22e-6', function() { | ||
var result = convert(1).cm.toMiles(); | ||
result.should.be.within(6.21e-6, 6.22e-6); | ||
}); | ||
}); | ||
describe('toCentimeters', function() { | ||
it('should return the input value', function() { | ||
var result = convert(1).cm.toCentimeters(); | ||
result.should.eql(1); | ||
}); | ||
}); | ||
describe('toMeters', function() { | ||
it('should return 0.01', function() { | ||
var result = convert(1).centimeters.toMeters(); | ||
result.should.eql(0.01); | ||
}); | ||
}); | ||
describe('toKilometers', function() { | ||
it('should return 0.00001', function() { | ||
var result = convert(1).cm.toKilometers(); | ||
result.should.eql(0.00001); | ||
}); | ||
}); | ||
describe('toRadians', function() { | ||
it('should return a value between 8.97e-8 and 8.98e-8', function() { | ||
var result = convert(1).cm.toRadians(); | ||
result.should.be.within(8.97e-8, 8.98e-8); | ||
}); | ||
}); | ||
}); | ||
describe('m', function() { | ||
describe('toInches', function() { | ||
it('should return a value between 39.3 and 39.4', function() { | ||
var result = convert(1).m.toInches(); | ||
result.should.be.within(39.3, 39.4); | ||
}); | ||
}); | ||
describe('toFeet', function() { | ||
it('should return a value between 3.28 and 3.29', function() { | ||
var result = convert(1).m.toFeet(); | ||
result.should.be.within(3.28, 32.9); | ||
}); | ||
}); | ||
describe('toYards', function() { | ||
it('should return a value between 1 and 1.1', function() { | ||
var result = convert(1).m.toYards(); | ||
result.should.be.within(1, 1.1); | ||
}); | ||
}); | ||
describe('toMiles', function() { | ||
it('should return a value between 6.21e-4 and 6.22e-4', function() { | ||
var result = convert(1).m.toMiles(); | ||
result.should.be.within(6.21e-4, 6.22e-4); | ||
}); | ||
}); | ||
describe('toCentimeters', function() { | ||
it('should return 100', function() { | ||
var result = convert(1).m.toCentimeters(); | ||
result.should.eql(100); | ||
}); | ||
}); | ||
describe('toMeters', function() { | ||
it('should return the input value', function() { | ||
var result = convert(1).m.toMeters(); | ||
result.should.eql(1); | ||
}); | ||
}); | ||
describe('toKilometers', function() { | ||
it('should return 0.001', function() { | ||
var result = convert(1).m.toKilometers(); | ||
result.should.eql(0.001); | ||
}); | ||
}); | ||
describe('toRadians', function() { | ||
it('should return a value between 8.97e-6 and 8.98e-6', function() { | ||
var result = convert(1).m.toRadians(); | ||
result.should.be.within(8.97e-6, 8.98e-6); | ||
}); | ||
}); | ||
}); | ||
describe('km', function() { | ||
describe('toInches', function() { | ||
it('should return 39370.1', function() { | ||
var result = convert(1).km.toInches(); | ||
result.should.eql(39370.1); | ||
}); | ||
}); | ||
describe('toFeet', function() { | ||
it('should return a 3280.84', function() { | ||
var result = convert(1).km.toFeet(); | ||
result.should.eql(3280.84); | ||
}); | ||
}); | ||
describe('toYards', function() { | ||
it('should return 1093.61', function() { | ||
var result = convert(1).km.toYards(); | ||
result.should.eql(1093.61); | ||
}); | ||
}); | ||
describe('toMiles', function() { | ||
it('should return a value between 0.621 and 0.622', function() { | ||
var result = convert(1).km.toMiles(); | ||
result.should.be.within(0.621, 0.622); | ||
}); | ||
}); | ||
describe('toCentimeters', function() { | ||
it('should return 100000', function() { | ||
var result = convert(1).km.toCentimeters(); | ||
result.should.eql(100000); | ||
}); | ||
}); | ||
describe('toMeters', function() { | ||
it('should return 1000', function() { | ||
var result = convert(1).km.toMeters(); | ||
result.should.eql(1000); | ||
}); | ||
}); | ||
describe('toKilometers', function() { | ||
it('should return the input value', function() { | ||
var result = convert(1).km.toKilometers(); | ||
result.should.eql(1); | ||
}); | ||
}); | ||
describe('toRadians', function() { | ||
it('should return a value between 8.97e-3 and 8.98e-3', function() { | ||
var result = convert(1).km.toRadians(); | ||
result.should.be.within(8.97e-3, 8.98e-3); | ||
}); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
25789
786
1