-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kris Urbas
committed
Nov 1, 2023
1 parent
ed09cc2
commit 14d4a8e
Showing
5 changed files
with
77 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const V1_SUFFIX = ".lens"; | ||
const V2_NAMESPACE = "lens"; | ||
|
||
function isV1Handle(handle: string): boolean { | ||
return handle.endsWith(".lens"); | ||
} | ||
|
||
/** | ||
* v1 handle format: `handle.lens` | ||
* v2 handle format: `namespace/handle` | ||
*/ | ||
export function mapV1HandleToV2(handle: string): string { | ||
if (isV1Handle(handle)) { | ||
const localName = handle.slice(0, -V1_SUFFIX.length); | ||
return `${V2_NAMESPACE}/${localName}`; | ||
} | ||
|
||
return handle; | ||
} |