Skip to content

Commit 21c097f

Browse files
committed
stateful insert
Signed-off-by: Tobias Gurtzick <[email protected]>
1 parent 94f2710 commit 21c097f

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

lib/methods/v2/statetravel.js

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,22 @@ class StateTravel {
2323
this.internals = internals;
2424
this.driver = driver;
2525
this._counter = 0;
26-
}
27-
28-
async step () {
29-
return State.step(this.driver, ++this._counter, this.internals);
30-
}
26+
this._default = async function _default () {
27+
await State.step(this.driver, ++this._counter, this.internals);
3128

32-
async update () {
33-
return State.update(
34-
this.driver,
35-
this.file,
36-
this.internals.modSchema,
37-
this.internals
38-
);
39-
}
40-
41-
async default () {
42-
await this.step();
43-
const res = await this.update();
44-
45-
return res;
29+
return State.update(
30+
this.driver,
31+
this.file,
32+
this.internals.modSchema,
33+
this.internals
34+
);
35+
};
4636
}
4737
}
4838

4939
Object.keys(DEFAULT).forEach(m => {
5040
StateTravel.prototype[m] = async function (...args) {
51-
await this.step();
52-
const res = await this.update();
53-
54-
return res;
41+
return this._default();
5542
};
5643
});
5744

0 commit comments

Comments
 (0)