Skip to content

Commit 0c9bf9f

Browse files
shiffmancvalenzuela
authored andcommitted
Fixing up SketchRNN (#232)
1 parent cad483d commit 0c9bf9f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/SketchRNN/index.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,25 @@ class SketchRNN {
6262
return result;
6363
}
6464

65-
async generate(options, seedStrokes, callback) {
65+
async generate(optionsOrCallback, seedOrCallback, cb) {
66+
let callback;
67+
let options;
68+
let seedStrokes;
69+
70+
if (typeof optionsOrCallback === 'function') {
71+
options = {};
72+
seedStrokes = [];
73+
callback = optionsOrCallback;
74+
} else if (typeof seedOrCallback === 'function') {
75+
options = optionsOrCallback || {};
76+
seedStrokes = [];
77+
callback = seedOrCallback;
78+
} else {
79+
options = optionsOrCallback || {};
80+
seedStrokes = seedOrCallback || [];
81+
callback = cb;
82+
}
83+
6684
const strokes = seedStrokes.map((s) => {
6785
const up = s.pen === 'up' ? 1 : 0;
6886
const down = s.pen === 'down' ? 1 : 0;

0 commit comments

Comments
 (0)