Introduce `skip` and `take` operators
Description
I think everyone had to write logic for limiting calls to effects or events. For example, limiting the number of repeated requests (take) or displaying some kind of warning if the user abuses a button or other interactive element (skip). They are based on abstract and repeating elements that can be put into separate operators - skip & take.
These operators were inspired by their rxjs analogs: skip - https://rxjs.dev/api/index/function/skip; take - https://rxjs.dev/api/index/function/take.
I know the effector API tries to be minimalistic. I agree with this. But I don't consider these particular operators redundant. If you think otherwise, you can safely close this PR by writing feedback.
In case of positive feedback, I am ready to complete the entire checklist for adding new operators and follow your comments in order to bring these operators to release.
Checklist for a new method
- [x] Create a directory for the new method in the
srcdirectory inparam-case - [x] Place the source code to
src/method-name/index.tsin ESModules export incamelCasenamed export - [ ] Add tests to
src/method-name/method-name.test.ts - [ ] Add fork tests to
src/method-name/method-name.fork.test.ts - [ ] Add type tests to
test-typings/method-name.ts- Use
// @ts-expect-errorto mark expected type error import { expectType } from 'tsd'to check expected return type
- Use
- [ ] Add documentation in
src/method-name/readme.md- Add header
Patronum/MethodName - Add section with overloads, if have
- Add
Motivation,Formulae,ArgumentsandReturnsections for each overload - Add useful examples in
Examplesection for each overload
- Add header
- [ ] Fill frontmatter in
src/method-name/readme.md- Add
title. Make sure it uses camelCase syntax just like the method itself - Add
slug. Use param-case to write it. In most cases it will be just liketitle - Add
desriptionwith one short sentence describing what method useful for - Add
group. To categorize method on/operatorspage. Full list of available groups, you can see in documentation/src/content/config.ts
- Add
Hello! Thank you for contribution! To quickly merge PR please review checklist in the PR description. It would be cool to write docs and tests