🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

json-as

Package Overview
Dependencies
Maintainers
1
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-as - npm Package Compare versions

Comparing version

to
0.5.34

transform/lib/hash.js

35

assembly/test.ts

@@ -5,10 +5,32 @@ import { backSlashCode, quoteCode } from "./src/chars";

// @json or @serializable work here
@json
class Vec3 {
x: i32;
y: i32;
z: i32;
x!: f32;
y!: f32;
z!: f32;
}
@json
class Player {
firstName!: string;
lastName!: string;
lastActive!: i32[];
age!: i32;
pos!: Vec3 | null;
isVerified!: boolean;
}
const player: Player = {
firstName: "Emmet",
lastName: "West",
lastActive: [8, 27, 2022],
age: 23,
pos: {
x: 3.4,
y: 1.2,
z: 8.3
},
isVerified: true
};
const vec: Vec3 = {

@@ -20,2 +42,7 @@ x: 3,

const serializedPlayer = JSON.stringify<Player>(player);
console.log(serializedPlayer);
const parsedPlayer = JSON.parse<Player>(serializedPlayer);
console.log(JSON.stringify(parsedPlayer));
const serializedVec3 = JSON.stringify(vec);

@@ -22,0 +49,0 @@ console.log(serializedVec3);

2

package.json
{
"name": "json-as",
"version": "0.5.33",
"version": "0.5.34",
"description": "JSON encoder/decoder for AssemblyScript",

@@ -5,0 +5,0 @@ "types": "assembly/index.ts",

@@ -71,3 +71,3 @@ import { toString, isStdlib } from "visitor-as/dist/utils.js";

// @ts-ignore
const type = member.type.name.identifier.text;
let type = toString(member.type);
const name = member.name.text;

@@ -74,0 +74,0 @@ this.currentClass.keys.push(name);

{
"name": "@json-as/transform",
"version": "0.5.33",
"version": "0.5.34",
"description": "JSON encoder/decoder for AssemblyScript",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -74,3 +74,4 @@ import {

// @ts-ignore
const type = member.type.name.identifier.text;
let type = toString(member.type);
const name = member.name.text;

@@ -77,0 +78,0 @@ this.currentClass.keys.push(name);