Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
takuro-sato committed Dec 11, 2023
1 parent 847a5b9 commit a927a89
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions js/ccf-app/src/textcodec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
*
* const bytes = new ccftextcodec.TextEncoder().encode("foo")
* ```
*
*
* If you need TextEncoder Web API as a globally accessible class:
* ```
* import * as ccftextcodec from '@microsoft/ccf-app/textcodec.js';
*
*
* if (globalThis != undefined && (globalThis as any).TextEncoder == undefined) {
* (globalThis as any).TextEncoder = ccftextcodec.TextEncoder;
* }
*
*
* ```
*
* @module
Expand All @@ -27,35 +27,35 @@
import { ccf } from "./global.js";

export type TextEncoderEncodeIntoResult = {
read?: number
written?: number
}
read?: number;
written?: number;
};

/**
* TextEncoder can be used to encode string to Uint8Array.
*/
export class TextEncoder {
/**
* Always returns "utf-8".
*/
public readonly encoding: string = "utf-8";
/**
* Always returns "utf-8".
*/
public readonly encoding: string = "utf-8";

/**
* Returns Uint8Array containing UTF-8 encoded text.
* @param input Input string to encode.
* @returns Encoded bytes.
*/
encode(input: string): Uint8Array {
return new Uint8Array(ccf.strToBuf(input))
}
/**
* Returns Uint8Array containing UTF-8 encoded text.
* @param input Input string to encode.
* @returns Encoded bytes.
*/
encode(input: string): Uint8Array {
return new Uint8Array(ccf.strToBuf(input));
}

/**
* Not implemented.
* @param input
* @param output
* @throws Always throws an Error object.
*/
encodeInto(input: string, output: Uint8Array): TextEncoderEncodeIntoResult {
throw new Error('Not implemented');
}
}
/**
* Not implemented.
* @param input
* @param output
* @throws Always throws an Error object.
*/
encodeInto(input: string, output: Uint8Array): TextEncoderEncodeIntoResult {
throw new Error("Not implemented");
}
}

0 comments on commit a927a89

Please sign in to comment.