codingjoe / codingjoe/esupgrade

Transformer: byte conversion helpers to Uint8Array base64/hex APIs

Open
#145 0 comments 0 reactions 0 assignees View on GitHub
newly available
Dominant language
JavaScript
Stars
13
Forks
2
Avg merge
1d 5h
Merged PRs (30d)
6

Description

## Summary
Add a transformer for byte conversion helper code to modern Uint8Array base64/hex APIs.

## Examples
```js
// before
const bytes = Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));

// after
const bytes = Uint8Array.fromBase64(base64);
```

```js
// before
const base64 = btoa(String.fromCharCode(...bytes));

// after
const base64 = bytes.toBase64();
```

```js
// before
const bytes = parseHex(hexString); // custom helper

// after
const bytes = Uint8Array.fromHex(hexString);
```

## Scope
- Baseline category: newly available.
- Only transform clearly equivalent helper patterns.

## Acceptance criteria
- Implement in src/newlyAvailable/
- Export from src/newlyAvailable.js
- Add tests in tests/newlyAvailable/
- Document compatibility caveats in README.md

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.