Advertisement
Guest User

Untitled

a guest
Jul 6th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async function asyncForEach(array, callback) {
  2.   for (let index = 0; index < array.length; index++) {
  3.     await callback(array[index], index, array);
  4.   }
  5. }
  6.  
  7. async function processSimulations(from: string, to: string) {
  8.   const files = fs
  9.     .readdirSync(from)
  10.     .filter(f => f.endsWith('.json'))
  11.  
  12.   asyncForEach(files, async (f) => {
  13.     console.log(f)
  14.     const input = loadSimulation(path.join(from, f))
  15.     const transformed = transform(input)
  16.     storeResults(path.join(to, f), transformed)
  17.   })
  18. }
  19.  
  20. processSimulations('data/jsons', 'public/jsons')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement