Skip to content

Commit

Permalink
Fixing up SketchRNN (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiffman authored and cvalenzuela committed Nov 1, 2018
1 parent cad483d commit 0c9bf9f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/SketchRNN/index.js
Expand Up @@ -62,7 +62,25 @@ class SketchRNN {
return result;
}

async generate(options, seedStrokes, callback) {
async generate(optionsOrCallback, seedOrCallback, cb) {
let callback;
let options;
let seedStrokes;

if (typeof optionsOrCallback === 'function') {
options = {};
seedStrokes = [];
callback = optionsOrCallback;
} else if (typeof seedOrCallback === 'function') {
options = optionsOrCallback || {};
seedStrokes = [];
callback = seedOrCallback;
} else {
options = optionsOrCallback || {};
seedStrokes = seedOrCallback || [];
callback = cb;
}

const strokes = seedStrokes.map((s) => {
const up = s.pen === 'up' ? 1 : 0;
const down = s.pen === 'down' ? 1 : 0;
Expand Down

0 comments on commit 0c9bf9f

Please sign in to comment.