CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
JsonEncoderStable.js28 linesDownload Raw Back to json
1"use strict";2Object.defineProperty(exports, "__esModule", { value: true });3exports.JsonEncoderStable = void 0;4const JsonEncoder_1 = require("./JsonEncoder");5const insertion2_1 = require("@jsonjoy.com/util/lib/sort/insertion2");6const objKeyCmp_1 = require("@jsonjoy.com/util/lib/objKeyCmp");7class JsonEncoderStable extends JsonEncoder_1.JsonEncoder {8    writeObj(obj) {9        const writer = this.writer;10        const keys = Object.keys(obj);11        (0, insertion2_1.sort)(keys, objKeyCmp_1.objKeyCmp);12        const length = keys.length;13        if (!length)14            return writer.u16(0x7b7d);15        writer.u8(0x7b);16        for (let i = 0; i < length; i++) {17            const key = keys[i];18            const value = obj[key];19            this.writeStr(key);20            writer.u8(0x3a);21            this.writeAny(value);22            writer.u8(0x2c);23        }24        writer.uint8[writer.x - 1] = 0x7d;25    }26}27exports.JsonEncoderStable = JsonEncoderStable;28//# sourceMappingURL=JsonEncoderStable.js.map
basant307/AI_Governance_Project · CoolFace