LibJS: Implement rawJSON and isRawJSON functions

This commit is contained in:
aplefull
2025-04-23 19:43:00 +02:00
committed by Tim Flynn
parent e0ceb66580
commit 223c9c91e6
Notes: github-actions[bot] 2025-04-24 13:34:52 +00:00
10 changed files with 209 additions and 4 deletions

View File

@@ -0,0 +1,14 @@
test("JSON.isRawJSON basic functionality", () => {
const values = [1, 1.1, null, false, true, "123"];
for (const value of values) {
expect(JSON.isRawJSON(value)).toBeFalse();
expect(JSON.isRawJSON(JSON.rawJSON(value))).toBeTrue();
}
expect(JSON.isRawJSON(undefined)).toBeFalse();
expect(JSON.isRawJSON(Symbol("123"))).toBeFalse();
expect(JSON.isRawJSON([])).toBeFalse();
expect(JSON.isRawJSON({})).toBeFalse();
expect(JSON.isRawJSON({ rawJSON: "123" })).toBeFalse();
});