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 20 21 22 23 24 25 26 27 28 | 48x 48x 48x 48x 126x 126x 3x 123x 126x 48x 48x 2x 2x 48x | import { encodeValue } from './index'; import { ValueType } from '../types'; import { EncodeContext } from '../encode'; export function encodeObject(value: any, context: EncodeContext): void { const { writer, links } = context; links.push(value); const keys = Object.getOwnPropertyNames(value); for (const key of keys) { const number = parseFloat(key); if (Number.isInteger(number)) { encodeValue(number, context); } else { encodeValue(key, context); } encodeValue(value[key], context); } const symbols = Object.getOwnPropertySymbols(value); for (const symbol of symbols) { encodeValue(symbol, context); encodeValue(value[symbol], context); } writer.writeUintVar(ValueType.END); } |