Skip to content

Commit

Permalink
demo enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
ewfian committed Oct 14, 2023
1 parent 4565879 commit a692f4d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ <h1>Pickle Parser Demo</h1>
reader.onload = function (event) {
try {
const buffer = new Uint8Array(event.target.result);
const parser = new pickleparser.Parser();
const parser = new pickleparser.Parser({
unpicklingTypeOfSet: 'Set',
unpicklingTypeOfDictionary: 'Map',
});
const obj = parser.parse(buffer);
window.obj = obj;
const replacer = (_, value) => {
Expand All @@ -46,6 +49,9 @@ <h1>Pickle Parser Demo</h1>
if (typeof value === 'bigint') {
return value.toString();
}
if (value?.constructor?.name === 'PFunction') {
return value.args;
}
return value;
};
const json = JSON.stringify(obj, replacer, 4);
Expand Down

0 comments on commit a692f4d

Please sign in to comment.