Skip to content

Instantly share code, notes, and snippets.

@tgriesser
Last active August 29, 2015 14:17
Show Gist options
  • Save tgriesser/e992371db2d4b013895c to your computer and use it in GitHub Desktop.
Save tgriesser/e992371db2d4b013895c to your computer and use it in GitHub Desktop.
var chunksize = 50;
return (function next(items) {
if (!items.length) { return; }
return knex('sites')
.insert(items.slice(0, chunksize))
.then(function () {
return next(items.slice(chunksize));
});
})(data())
.then(function() { return deps.updateSeq('sites') });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment