Compare commits
No commits in common. "c7d33afe9d4176456706e629881d88ab2aab4e21" and "5f574204bb848ddded7bf59806185f3a623502bf" have entirely different histories.
c7d33afe9d
...
5f574204bb
25
README.md
25
README.md
@ -1,16 +1,17 @@
|
|||||||
# @yanick/remeda
|
# @yanick/remeda
|
||||||
|
|
||||||
This package provides a few functions to the already awesome
|
This package adds a few functions to the already awesome
|
||||||
[remeda](https://remedajs.com/) library that I really want, but wasn't able to
|
[remeda](https://remedajs.com/) library. For convenience, it
|
||||||
get in Remeda itself.
|
re-export everything that remeda has.
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Just import the additional functions from `@yanick/remeda-extra`.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
import { pipe } from 'remeda'; // as usual
|
import { matches, pipe } from '@yanick/remeda';
|
||||||
import { matches } from '@yanick/remeda-extra'; // yanick-themed bonus feature!
|
|
||||||
|
// equivalent to
|
||||||
|
|
||||||
|
import { pipe } from 'remeda';
|
||||||
|
import { matches } from '@yanick/remeda';
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Additional functions
|
## Additional functions
|
||||||
@ -24,8 +25,7 @@ to return a boolean), or a value. If the value is an object, the matching
|
|||||||
will be recursive.
|
will be recursive.
|
||||||
|
|
||||||
```
|
```
|
||||||
import { pipe } from 'remeda';
|
import { matches, pipe } from '@yanick/remeda';
|
||||||
import { matches } from '@yanick/remeda-extra';
|
|
||||||
|
|
||||||
matches( 'potato', 'potato'); // => true
|
matches( 'potato', 'potato'); // => true
|
||||||
matches( 'potato', 'turnip'); // => false
|
matches( 'potato', 'turnip'); // => false
|
||||||
@ -42,9 +42,6 @@ pipe( { 'a': 4, 'b': 5, 'c': 6 }, R.matches({ 'a': 4, 'c': 6 })) // => true
|
|||||||
### `sample(target, size | { size: number, repeating: boolean })`
|
### `sample(target, size | { size: number, repeating: boolean })`
|
||||||
### `sample(size | { size: number, repeating: boolean })(target)`
|
### `sample(size | { size: number, repeating: boolean })(target)`
|
||||||
|
|
||||||
Like the `sample` that comes with Remeda, but this one shuffles its output
|
|
||||||
automatically.
|
|
||||||
|
|
||||||
Returns random elements of the array. If `size` is bigger than the array
|
Returns random elements of the array. If `size` is bigger than the array
|
||||||
length and `repeating` is false, returns a number of samples equal to
|
length and `repeating` is false, returns a number of samples equal to
|
||||||
the size of the whole array.
|
the size of the whole array.
|
||||||
|
@ -6,8 +6,8 @@ tasks:
|
|||||||
build: tsc
|
build: tsc
|
||||||
|
|
||||||
test:
|
test:
|
||||||
deps: [ build ]
|
|
||||||
cmds:
|
cmds:
|
||||||
|
- { task: build }
|
||||||
- vitest run src
|
- vitest run src
|
||||||
|
|
||||||
pack: npm pack
|
pack: npm pack
|
||||||
|
11
package.json
11
package.json
@ -1,14 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "@yanick/remeda-extra",
|
"name": "@yanick/remeda",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "A handful of added functions for Remeda",
|
"description": "Remeda, plus a handful of added functions",
|
||||||
"repository": "https://git.babyl.ca/yanick/remeda-extra.git",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https:/git.babyl.ca/yanick/remeda-extra/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https:/git.babyl.ca/yanick/remeda-extra/issues",
|
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
export * from './matches.js';
|
export * from 'remeda';
|
||||||
export * from './sample.js';
|
|
||||||
|
export * from './matches';
|
||||||
|
Loading…
Reference in New Issue
Block a user