⚡ Zero-dependency plcbundle library exclusively for Bun
1/**
2 * Example process function for general operation processing
3 *
4 * Usage:
5 * plcbundle-bun process ./examples/processor.ts
6 */
7
8export function process({ op, position, bundle, line }: {
9 op: any;
10 position: number;
11 bundle: number;
12 line: string;
13}) {
14 // Example: Count operations by year
15 const year = op.createdAt.substring(0, 4);
16
17 // Example: Log specific operations
18 if (position % 1000 === 0) {
19 console.log(`Bundle ${bundle}, position ${position}: ${op.did}`);
20 }
21
22 // Example: Custom logic
23 if (op.operation?.alsoKnownAs?.length > 0) {
24 // Do something with operations that have handles
25 }
26
27 // No need to return anything
28}