Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1036: emoji case in the protobuf #1324

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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