0.0.12 • Published 5 years ago
@oss-stealth/satya v0.0.12
Satya
Tree immutable undo/redo stack using immer RFC6902 style patches
const satya = new Satya(typescriptSchema);
satya.update([
{
type: "node",
operation: {
path: [],
op: "replace",
value: sourceFile
}
}
]);
satya.update([
{
type: "node",
operation: {
path: ["statements", 0],
op: "add",
value: {}
}
}
]);
satya.update([
{
type: "metadata",
operation: {
path: ["statements", 0, SatyaMetaSym, "general", "expanded"],
op: "add",
value: true
}
}
]);
const meta1 = satya.readMetaData(
((satya.state as ts.SourceFile)
.statements[0] as unknown) as ts.VariableDeclaration,
"general",
"expanded"
);
expect(meta1).toBe(true);
##TODO
- compute reverse for "replace" | "remove" | "add"
- implement helper functions for undo/redo