Skip to content

Commit

Permalink
fix the place of Uint8Array to / from base64 and hex in the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Apr 16, 2024
1 parent 1bb8d08 commit 3c2deac
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions README.md
Expand Up @@ -160,6 +160,7 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
- [`Array.fromAsync`](#arrayfromasync)
- [`JSON.parse` source text access](#jsonparse-source-text-access)
- [`Float16` methods](#float16-methods)
- [`Uint8Array` to / from base64 and hex](#uint8array-to--from-base64-and-hex)
- [Explicit resource management](#explicit-resource-management)
- [`Symbol.metadata` for decorators metadata proposal](#symbolmetadata-for-decorators-metadata-proposal)
- [Stage 2.7 proposals](#stage-27-proposals)
Expand All @@ -173,7 +174,6 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
- [`String.dedent`](#stringdedent)
- [`RegExp` escaping](#regexp-escaping)
- [`Symbol` predicates](#symbol-predicates)
- [`Uint8Array` to / from base64 and hex](#uint8array-to--from-base64-and-hex)
- [Stage 1 proposals](#stage-1-proposals)
- [`Observable`](#observable)
- [New collections methods](#new-collections-methods)
Expand Down Expand Up @@ -2423,6 +2423,34 @@ view.setFloat16(0, 1.337);
console.log(view.getFloat16(0)); // => 1.3369140625
```

##### [`Uint8Array` to / from base64 and hex](https://github.com/tc39/proposal-arraybuffer-base64)[⬆](#index)
Modules [`esnext.uint8-array.from-base64`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.from-base64.js), [`esnext.uint8-array.from-hex`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.from-hex.js), [`esnext.uint8-array.to-base64`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.to-base64.js), [`esnext.uint8-array.to-hex`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.to-hex.js).
```js
class Uint8Array {
static fromBase64(string, options?: { alphabet?: 'base64' | 'base64url', strict?: boolean }): Uint8Array;
static fromHex(string): Uint8Array;
toBase64(options?: { alphabet?: 'base64' | 'base64url' }): string;
toHex(): string;
}
```
```
[*CommonJS entry points:*](#commonjs-api)
```js
core-js/proposals/array-buffer-base64
core-js(-pure)/full/typed-array/from-base64
core-js(-pure)/full/typed-array/from-hex
core-js(-pure)/full/typed-array/to-base64
core-js(-pure)/full/typed-array/to-hex
```
*Example*:
```js
let arr = new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]);
console.log(arr.toBase64()); // => 'SGVsbG8gV29ybGQ='
console.log(arr.toHex()); // => '48656c6c6f20576f726c64'
console.log(Uint8Array.fromBase64('SGVsbG8gV29ybGQ=')); // => Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100])
console.log(Uint8Array.fromHex('48656c6c6f20576f726c64')); // => Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100])
```
##### [Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management)[⬆](#index)
Note: **This is only built-ins for this proposal, `using` syntax support requires transpiler support.**
Expand Down Expand Up @@ -2761,34 +2789,6 @@ Symbol.isWellKnownSymbol(Symbol.iterator); // => true
Symbol.isWellKnownSymbol(Symbol('key')); // => false
```

##### [`Uint8Array` to / from base64 and hex](https://github.com/tc39/proposal-arraybuffer-base64)[⬆](#index)
Modules [`esnext.uint8-array.from-base64`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.from-base64.js), [`esnext.uint8-array.from-hex`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.from-hex.js), [`esnext.uint8-array.to-base64`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.to-base64.js), [`esnext.uint8-array.to-hex`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.to-hex.js).
```js
class Uint8Array {
static fromBase64(string, options?: { alphabet?: 'base64' | 'base64url', strict?: boolean }): Uint8Array;
static fromHex(string): Uint8Array;
toBase64(options?: { alphabet?: 'base64' | 'base64url' }): string;
toHex(): string;
}
```
```
[*CommonJS entry points:*](#commonjs-api)
```js
core-js/proposals/array-buffer-base64
core-js(-pure)/full/typed-array/from-base64
core-js(-pure)/full/typed-array/from-hex
core-js(-pure)/full/typed-array/to-base64
core-js(-pure)/full/typed-array/to-hex
```
*Example*:
```js
let arr = new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]);
console.log(arr.toBase64()); // => 'SGVsbG8gV29ybGQ='
console.log(arr.toHex()); // => '48656c6c6f20576f726c64'
console.log(Uint8Array.fromBase64('SGVsbG8gV29ybGQ=')); // => Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100])
console.log(Uint8Array.fromHex('48656c6c6f20576f726c64')); // => Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100])
```
#### Stage 1 proposals[⬆](#index)
[*CommonJS entry points:*](#commonjs-api)
```js
Expand Down

0 comments on commit 3c2deac

Please sign in to comment.