fix(import): remove commas from numbers (#3011)
This commit is contained in:
parent
4ed6d50400
commit
3d0b42e72e
@ -22,6 +22,12 @@ describe('number value parser', () => {
|
||||
expect(parser.errors.length === 0).toBeTruthy();
|
||||
expectValue('22.5507%').toBe(0.225507);
|
||||
expect(parser.errors.length === 0).toBeTruthy();
|
||||
expectValue('2,122,121,122').toBe(2122121122);
|
||||
expect(parser.errors.length === 0).toBeTruthy();
|
||||
expectValue('2,122,121,122.5507').toBe(2122121122.5507);
|
||||
expect(parser.errors.length === 0).toBeTruthy();
|
||||
expectValue('11,122.5507%').toBe(111.225507);
|
||||
expect(parser.errors.length === 0).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should be null', () => {
|
||||
|
@ -11,6 +11,7 @@ export class NumberValueParser extends BaseValueParser {
|
||||
} else if (['n/a', '-'].includes(value.toLowerCase())) {
|
||||
this.value = null;
|
||||
} else {
|
||||
value = value.replace(/,/g, '');
|
||||
if (value.endsWith('%')) {
|
||||
value = percent2float(value);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user