mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2026-01-28 22:54:34 +01:00
Add IpAddress.toBinaryString() method
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import {emBin} from "../core/formatter";
|
||||
|
||||
export type OctetNumber = 1 | 2 | 3 | 4;
|
||||
export type NetworkClass = 'a' | 'b' | 'c' | 'd' | 'e';
|
||||
|
||||
@@ -33,6 +35,11 @@ export class IpAddress {
|
||||
return `${this.firstByte}.${this.secondByte}.${this.thirdByte}.${this.fourthByte}`;
|
||||
}
|
||||
|
||||
toBinaryString() {
|
||||
|
||||
return `${emBin(this.firstByte)}).${emBin(this.secondByte)}.${emBin(this.thirdByte)}.${emBin(this.fourthByte)}`;
|
||||
}
|
||||
|
||||
clone(): IpAddress {
|
||||
return new IpAddress(this.firstByte, this.secondByte, this.thirdByte, this.fourthByte);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user