Appearance
创建一个函数,调用次数不超过 n 次。之后再调用将返回最后一次调用的结果。
n
import { before } from '@base-web-kits/base-tools-ts'; let count = 0; const limited = before(3, () => ++count); limited(); // 1 limited(); // 2 limited(); // 2
n (number)
func (Function)
(Function)