Files
common/packages/x-textdecoder/src/fallback.ts
T
Jaco 9e1e49a1b8 Additional tests (need to expand more...) (#1172)
* Additional utility tests

* Args on constructor
2021-11-11 15:20:01 +02:00

21 lines
520 B
TypeScript

// Copyright 2017-2021 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
// This is very limited, only handling Ascii values
export class TextDecoder {
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-useless-constructor
constructor (_?: 'utf-8' | 'utf8') {
// nothing
}
decode (value: Uint8Array): string {
let result = '';
for (let i = 0; i < value.length; i++) {
result += String.fromCharCode(value[i]);
}
return result;
}
}