Skip to content

Instantly share code, notes, and snippets.

@vitaly-t
Created November 13, 2022 23:09
Show Gist options
  • Save vitaly-t/129f82dc80a529f6ef7c8f334d1cdfc6 to your computer and use it in GitHub Desktop.
Save vitaly-t/129f82dc80a529f6ef7c8f334d1cdfc6 to your computer and use it in GitHub Desktop.
import {pipe, reduce} from 'iter-ops';
const m = new Map<string, number>();
m.set('one', 1);
m.set('two', 2);
m.set('three', 3);
const i = pipe(m.values(), reduce((a, c) => a + c, 5));
console.log(...i); //=> 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment