Skip to content

Commit

Permalink
fix(buffer): restrict encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Sep 5, 2020
1 parent 2509745 commit 85d7e56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/api/js-utils.encode.md
Expand Up @@ -9,15 +9,15 @@ Concatenate then encode a list of buffers.
<b>Signature:</b>

```typescript
export declare function encode(chunks: Array<Buffer>, encoding: string): string;
export declare function encode(chunks: Array<Buffer>, encoding: AllowedBufferEncoding): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| chunks | Array&lt;Buffer&gt; | |
| encoding | string | |
| encoding | AllowedBufferEncoding | |

<b>Returns:</b>

Expand Down
4 changes: 3 additions & 1 deletion src/Buffer.ts
@@ -1,3 +1,5 @@
export type AllowedBufferEncoding = 'ascii' | 'utf-8';

/**
* Concatenate a list of buffers.
*
Expand All @@ -13,7 +15,7 @@ export function concat(chunks: Array<Buffer>): Buffer {
*
* @public
*/
export function encode(chunks: Array<Buffer>, encoding: string): string {
export function encode(chunks: Array<Buffer>, encoding: AllowedBufferEncoding): string {
if (chunks.length === 0) {
return '';
}
Expand Down

0 comments on commit 85d7e56

Please sign in to comment.