Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

jce

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jce

JCE reader and writer for JavaScript

latest
Source
npmnpm
Version
0.2.3
Version published
Maintainers
1
Created
Source

jce

一种自解释型的 TTLV<Tag,Type,Length,Value> 数据交换协议

Install with npm:

# npm i jce

Simple Example:

const jce = require("jce");

// encode by array
const encoded1 = jce.encode([
    "abc", 1, 3.3, null, //null and undefined will be skipped
    [0, 12n, Buffer.from("def")],   //list
    {a: 0xffffff, b: BigInt(2**60)} //map
]);

// encode by object
const encoded2 = jce.encode({
    1:"a", 3:12.34, 5:{}, 7:[]
});

// decode
jce.decode(encoded1);
jce.decode(encoded2);

Struct Usage:

const jce = require("jce");
const struct = {
    foo: 0, //tag0
    bar: 1, //tag1
    baz: 2  //tag2
};
const object = {
    foo: 12.34,
    bar: "bar123"
};
const encoded = jce.encode(object, struct);
const decoded = jce.decode(encoded);

Nesting Usage:
@see test.js

Keywords

jce-protocol

FAQs

Package last updated on 25 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts