json-joy
Version:
Collection of libraries for building collaborative editing apps.
16 lines (15 loc) • 396 B
JavaScript
import { $test } from './ops/test';
import { $starts } from './ops/starts';
import { $add } from './ops/add';
export const codegenOp = (op) => {
switch (op.op()) {
case 'add':
return $add(op);
case 'test':
return $test(op);
case 'starts':
return $starts(op);
default:
return (doc) => op.apply(doc).doc;
}
};