Skip to content

Commit

Permalink
Fix #1036: emoji case in the protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Oct 11, 2024
1 parent 1a1778d commit 07f2d33
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typia",
"version": "6.11.1",
"version": "6.11.2",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
8 changes: 1 addition & 7 deletions src/functional/$strlen.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
export const $strlen = (s: string): number => {
let b: number;
let i: number;
let c: number;
for (b = i = 0; (c = s.charCodeAt(i++)); b += c >> 11 ? 3 : c >> 7 ? 2 : 1);
return b;
};
export const $strlen = (str: string): number => new Blob([str]).size;
18 changes: 18 additions & 0 deletions test/src/features/issues/test_issue_1306_protobuf_emoji.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import typia from "typia";

import { TestValidator } from "../../helpers/TestValidator";

interface ITest {
test: string;
}

export const test_issue_1306_protobuf_emoji = (): void => {
const input: ITest = {
test: "🫢",
};
const encoded: Uint8Array = typia.protobuf.encode<ITest>(input);
const decoded: ITest = typia.protobuf.decode<ITest>(encoded);

TestValidator.equals("decoded")(decoded)(input);
TestValidator.equals("length")(decoded.test.length)(input.test.length);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type MyObj = {
private: boolean | null;
};

export const test_issue_1321_private_key_in_protobuf = (): void => {
export const test_issue_1321_protobuf_reserved_keyword = (): void => {
const input: MyObj = {
private: true,
};
Expand Down

0 comments on commit 07f2d33

Please sign in to comment.