loading
open in
index.js
1
2
3
4
5
6
7
8
9
10
11
const takeUntil = (times, fn) => () => times-- > 0 && fn()

const hello = () => console.log('Executando função...')

const fn = takeUntil(1, hello)

fn()
fn()
fn()
fn()
fn()
node v10.15.2 linux/amd64