-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TruncateAddress pipe + Multiple fixes
- Loading branch information
1 parent
1f9f7fb
commit 086ff50
Showing
5 changed files
with
26 additions
and
3 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
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
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
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,8 @@ | ||
import { TruncateAddressPipe } from './truncate-address.pipe'; | ||
|
||
describe('TruncateAddressPipe', () => { | ||
it('create an instance', () => { | ||
const pipe = new TruncateAddressPipe(); | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
}); |
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,13 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
|
||
@Pipe({ | ||
name: 'truncateAddress' | ||
}) | ||
export class TruncateAddressPipe implements PipeTransform { | ||
|
||
transform(value: string): string { | ||
if (!value) return ''; | ||
return `${value.substring(0, 6)}...${value.substring(value.length - 4)}`; | ||
} | ||
|
||
} |