-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
Hello π
First thing first, sorry for this dummy question,
I have this transit string:
{"~:user/email":"plop@plop.com","~:user/uid":"OXeehCUcSCaglURUsQ","~:block/uid":"uqJ"}
that I would like to convert to:
[":user/email", "plop@plop.com", ":user/uid", "OXeehCUcSCaglURUsQ", ":block/uid", "uqJ"]
I've tried:
function mapToObj(transitMap) {
// object with "~:xxx/xxx" keys:
return mapKeys(writer.write(transitMap, { marshalTop: false }), (val, k) => k.replace(/^~:/, '')); // :O
}
const convert = pipe(mapToObj, toPairs, flatten);
// usage:
convert(deserializedTransitString) => [..., ... ,...]
I've read most of the code of transit-js but could not find an easy way (beside relying a transform mapper when calling writer.write) to do this. Is this the only way or am I missing something?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels