Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 12x 12x 12x 2x 2x 2x 2x 4x 4x 4x | import {sort} from '@jsonjoy.com/util/lib/sort/insertion';
import {MsgPackEncoderFast} from './MsgPackEncoderFast';
/**
* @category Encoder
*/
export class MsgPackEncoderStable extends MsgPackEncoderFast {
public writeObj(obj: Record<string, unknown>): void {
const keys = sort(Object.keys(obj));
const length = keys.length;
this.writeObjHdr(length);
for (let i = 0; i < length; i++) {
const key = keys[i];
this.writeStr(key);
this.writeAny(obj[key]);
}
}
}
|