-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor token formatting using mixin
- Loading branch information
1 parent
e088d44
commit 8c8af96
Showing
2 changed files
with
15 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export const token = { | ||
methods: { | ||
formatToken(token) { | ||
// Ensure token is a string | ||
const tokenStr = String(token) | ||
// Format in the desired pattern | ||
// return tokenStr.match(/.{1,4}/g).join('-'); // For "1234-1234-1234" | ||
return tokenStr.match(/.{1,3}/g).join(" ") // For "123 412 341 234" | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters