-
Notifications
You must be signed in to change notification settings - Fork 1
Add slice, urlEncode, base64Encode, base64Decode, and coalesce functions #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com>
…dling Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com>
Sander-Toonen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add documentation for the new functions, also make sure the language server knows about the new functions
src/parsing/parser.ts
Outdated
| padRight: padRight, | ||
| padBoth: padBoth | ||
| padBoth: padBoth, | ||
| // New functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in b0fb3f9.
Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com>
Added in b0fb3f9:
|
| * Handles UTF-8 encoding properly | ||
| */ | ||
| export function base64Encode(str: string | undefined): string | undefined { | ||
| if (str === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Simplify this function by using "btoa" instead. Also create and document a base64Decode function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified base64Encode to use btoa and added base64Decode function using atob in c537880. Also added documentation and language server support for both functions, plus 7 new tests for base64Decode.
Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com>
Adds five new expression functions as requested.
New Functions
slice(s, start, end?)— Extract portion of string or array; supports negative indicesurlEncode(str)— URL-encode viaencodeURIComponentbase64Encode(str)— Base64-encode with proper UTF-8 handling usingbtoabase64Decode(str)— Base64-decode with proper UTF-8 handling usingatobcoalesce(a, b, ...)— Return first non-null, non-empty-string valueUsage
All functions follow existing patterns: return
undefinedforundefinedinputs, throw descriptive errors for type mismatches.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.