How to use the @tinkoff/utils/function/once function in @tinkoff/utils

To help you get started, we’ve selected a few @tinkoff/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TinkoffCreditSystems / tinkoff-request / packages / core / src / request / request.ts View on Github external
}

                    i += direction;
                    if (i < 0 || i >= len) {
                        return cb(false);
                    }

                    const plugin = plugins[i];
                    const pluginAction = plugin[event];

                    if (!pluginAction || !applyOrReturn([context], propOr('shouldExecute', true, plugin))) {
                        return next();
                    }

                    try {
                        pluginAction(context, once(next), makeRequest);
                    } catch (err) {
                        return next({ status: Status.ERROR, error: err });
                    }
                };