From 0b15b5d66667e361756865c590c8002f92150a52 Mon Sep 17 00:00:00 2001 From: hilja Date: Tue, 10 Dec 2019 19:27:29 +0100 Subject: [PATCH] Fix an example --- examples/batch.js | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/examples/batch.js b/examples/batch.js index d2bb7f1..1b12688 100644 --- a/examples/batch.js +++ b/examples/batch.js @@ -2,35 +2,11 @@ const batch = require('../src/batch') const files = 'fixtures/test-content/**' -// const results = batch(files, 1, async ({ goods, index, delay }) => { -// // await delay(1000) -// console.log(goods.data.title) - -// return goods - -// // return goods.data.title + ' ' + index -// }) - -// const testFunc = async () => { -// const results = await batch(files, 1, async ({ goods, index, delay }) => { -// return goods -// }) - -// console.log(results) -// } - -// testFunc() - ;(async () => { - const foo = await batch(files) + const postTitles = await batch(files, 1, async ({ goods, index, delay }) => { + // Do stuff to the data coming from the files. + return index + ': ' + goods.data.title + }) - console.log(foo) + console.log(postTitles) })() - -// console.log(results) - -// results -// .then(data => { -// console.log(data) -// }) -// .catch(error => console.error(error))