-
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.
feat: use base class for raw and methods
- Loading branch information
Showing
3 changed files
with
56 additions
and
44 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,31 @@ | ||
export class APTBase { | ||
/** | ||
* Raw-accessible key-value map of the APT format | ||
*/ | ||
protected raw: Map<string, string> | ||
|
||
/** | ||
* Base constructor. | ||
* This should never be used. | ||
*/ | ||
constructor() { | ||
this.raw = new Map() | ||
} | ||
|
||
/** | ||
* Get a raw string value from the Release contents | ||
* @param {string} key Release field name to search for | ||
* @returns {string?} Field value | ||
*/ | ||
get(key: string): string | undefined { | ||
return this.raw.get(key) | ||
} | ||
|
||
/** | ||
* Retrieve the number of fields defined in the Release contents | ||
* @returns {number} Field count | ||
*/ | ||
get fieldCount(): number { | ||
return this.raw.size | ||
} | ||
} |
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