@imigueldiaz/mongodb-labeler
Version:
A MongoDB-based labeling system for content moderation with cryptographic signing
14 lines (13 loc) • 381 B
JavaScript
import { cborEncode } from "@atproto/common";
export function excludeNullish(obj) {
return Object.entries(obj).reduce((acc, [key, value]) => {
if (value != null) {
acc[key] = value;
}
return acc;
}, {});
}
export function frameToBytes(op, body, tag) {
const frame = { op, body, ...(tag && { tag }) };
return cborEncode(frame);
}