Implement stripUnit with quantity. Oops fdescribe.

This commit is contained in:
hansmaad 2015-09-29 15:47:45 +02:00
parent 7475b5089c
commit 96244ad55c
2 changed files with 2 additions and 6 deletions

View File

@ -79,11 +79,7 @@ var Chartist = {
* @return {Number} Returns the string as number or NaN if the passed length could not be converted to pixel
*/
Chartist.stripUnit = function(value) {
if(typeof value === 'string') {
value = value.replace(/[^0-9\+-\.]/g, '');
}
return +value;
return Chartist.quantity(value).value;
};
/**

View File

@ -280,7 +280,7 @@ describe('Chartist core', function() {
});
});
fdescribe('quantity', function() {
describe('quantity', function() {
it('should return value for numbers', function() {
expect(Chartist.quantity(100)).toEqual({ value: 100 });