Skip to content

Commit

Permalink
Don't act on 1-digit strings
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec committed Aug 20, 2024
1 parent 46511b1 commit 3c1d55a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/TreeView/TreeSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function TreeSearch(props: TreeSearchProps): ReactElement {
* Note: doesn't act on strings with double/initial/final period (e.g.: .2.3.4, 1..3.4),
* because a user may be changing a digit (e.g.: 1.0.3.4 -> 1..3.4 -> 1.2.3.4). */
export function insertDecimalPoints(value: string): string {
if (/^\d(\.?\d)*$/.test(value)) {
if (/^\d(\.?\d)+$/.test(value)) {
value = value.replace(/\./g, "").split("").join(".");
}

Expand Down

0 comments on commit 3c1d55a

Please sign in to comment.