Skip to content

Commit

Permalink
feat: add encoder types
Browse files Browse the repository at this point in the history
  • Loading branch information
biejia committed Jul 29, 2020
1 parent 4758a2a commit a5c7efa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/common/utils/encoder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export function encoder(str: string, encoding = 'utf-8') {
import { THeaderEncoding } from '../../types/experimental';

export function encoder(str: string, encoding: THeaderEncoding = 'utf-8') {
if (encoding === 'utf-8') return str;
return Buffer.from(str).toString('latin1');
}
}
1 change: 1 addition & 0 deletions lib/types/experimental.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type THeaderEncoding = 'utf-8' | 'latin1';

0 comments on commit a5c7efa

Please sign in to comment.