Skip to content

Commit 536eadb

Browse files
natterstefans-yadav
authored andcommitted
chore: applied formatting
1 parent c238e9c commit 536eadb

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/number_format.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -694,35 +694,34 @@ class NumberFormat extends React.Component {
694694

695695
// check whether the deleted portion has a character that is part of a format
696696
const deletedValues = lastValue.substr(start, end - start);
697-
const formatGotDeleted = !![...deletedValues].find((deletedVal, idx) => this.isCharacterAFormat(idx + start, lastValue));
697+
const formatGotDeleted = !![...deletedValues].find((deletedVal, idx) =>
698+
this.isCharacterAFormat(idx + start, lastValue),
699+
);
698700

699701
// if it has, only remove characters that are not part of the format
700-
if(formatGotDeleted) {
701-
const deletedValuePortion = lastValue.substr(start)
702+
if (formatGotDeleted) {
703+
const deletedValuePortion = lastValue.substr(start);
702704
const recordIndexOfFormatCharacters = {};
703705
const resolvedPortion = [];
704706
[...deletedValuePortion].forEach((currentPortion, idx) => {
705-
if(this.isCharacterAFormat(idx + start, lastValue)){
707+
if (this.isCharacterAFormat(idx + start, lastValue)) {
706708
recordIndexOfFormatCharacters[idx] = currentPortion;
707709
} else if (idx > deletedValues.length - 1) {
708710
resolvedPortion.push(currentPortion);
709711
}
710-
})
712+
});
711713

712-
Object.keys(recordIndexOfFormatCharacters).forEach(idx => {
713-
if(resolvedPortion.length > idx){
714+
Object.keys(recordIndexOfFormatCharacters).forEach((idx) => {
715+
if (resolvedPortion.length > idx) {
714716
resolvedPortion.splice(idx, 0, recordIndexOfFormatCharacters[idx]);
715717
} else {
716-
resolvedPortion.push(recordIndexOfFormatCharacters[idx])
718+
resolvedPortion.push(recordIndexOfFormatCharacters[idx]);
717719
}
718-
})
720+
});
719721

720722
value = lastValue.substr(0, start) + resolvedPortion.join('');
721723
}
722724

723-
724-
725-
726725
//for numbers check if beforeDecimal got deleted and there is nothing after decimal,
727726
//clear all numbers in such case while keeping the - sign
728727
if (!format) {

0 commit comments

Comments
 (0)