scan.js 241 B

1234567891011
  1. 'use strict';
  2. const scan = (f, acc) => value => {
  3. const result = f(acc, value);
  4. if (result && typeof result.then == 'function') {
  5. return result.then(result => (acc = result));
  6. }
  7. return (acc = result);
  8. };
  9. module.exports = scan;