-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: split global type module (#63)
* refactor: move editor-version type and module Move editor-version type into corresponding module and move that module into the types folder * doc: jsdoc for editor-version type * refactor: move pkg-info type and module Move pkg-info type into corresponding module. Also move that module into types folder. * doc: jsdoc for pkg-info * refactor: rename module Rename upm-config to upm-config-io. This is in preparation for moving the UpmConfig type and functions which act on it into own module which should be called upm-config * refactor: move upm-config types to own module This will be its own module so that it can also contain helpers related to the type which do not involve io * doc: jsdoc for upm-config types * refactor: extract constant * refactor: split UpmAuth type Split into multiple types in preparation for further refactors * refactor: auth classification helpers * refactor: helpers for encoding/decoding basic auth * refactor: helper for always-auth * refactor: base64 helper functions * fix: incorrect type name * refactor: move type Move env type into corresponding module * fix: missing import * refactor: extract scoped-registry utilities Move ScopedRegistry type to own module and add utility functions with tests * refactor: make type local * refactor: make type local * refactor: make type local * refactor: extract module Move PkgManifest type to own module and create helper functions with tests. Also rename the manifest file and corresponding test file to pkg-manifest-io since that is what the module is there for * refactor: move type to own module Also add type documentation where I knew what to write * refactor: add prompt utilities * fix: type warning * fix: outdated type * refactor: cmd-option utility type * refactor: rename file
- Loading branch information
1 parent
613168e
commit bb1c999
Showing
37 changed files
with
923 additions
and
316 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
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
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,20 @@ | ||
import { Brand } from "ts-brand"; | ||
|
||
export type Base64 = Brand<string, "Base64">; | ||
|
||
/** | ||
* Encodes a string using base64 | ||
* @param s The string | ||
*/ | ||
export function encodeBase64(s: string): Base64 { | ||
return Buffer.from(s).toString("base64") as Base64; | ||
} | ||
|
||
/** | ||
* Decodes a base64 string | ||
* @param base64 The string | ||
*/ | ||
export function decodeBase64(base64: Base64): string { | ||
const buffer = Buffer.from(base64, "base64"); | ||
return buffer.toString("utf-8"); | ||
} |
Oops, something went wrong.