Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
b0ac5c8
chore@small
selfrefactor Jul 4, 2025
91c41f8
chore@small
selfrefactor Jul 4, 2025
7107fd7
chore@small
selfrefactor Jul 5, 2025
d70b5f7
chore@small
selfrefactor Jul 6, 2025
44f715b
chore@small
selfrefactor Jul 6, 2025
5d38fde
chore@small
selfrefactor Jul 6, 2025
25d1903
chore@small
selfrefactor Jul 6, 2025
ba690cc
chore@small
selfrefactor Jul 6, 2025
3679830
chore@small
selfrefactor Jul 6, 2025
2e067fb
chore@small
selfrefactor Jul 6, 2025
e3524b7
chore@small
selfrefactor Jul 6, 2025
9ff1277
Merge branch 'master' of github.com:selfrefactor/rambda into next-ver…
selfrefactor Jul 10, 2025
e4d38be
Fix R.includes
selfrefactor Jul 10, 2025
8337fe9
chore@small
selfrefactor Jul 10, 2025
f553d15
d
selfrefactor Jul 12, 2025
1e58d08
chore@small
selfrefactor Jul 12, 2025
30f6dd6
Merge branch 'master' of github.com:selfrefactor/rambda into next-ver…
selfrefactor Jul 27, 2025
def7fc9
chore@small
selfrefactor Jul 27, 2025
44ed90b
chore@small
selfrefactor Jul 30, 2025
218e47b
Merge branch 'master' of github.com:selfrefactor/rambda into next-ver…
selfrefactor Sep 3, 2025
b4be76e
chore@small
selfrefactor Sep 4, 2025
59f622f
chore@small
selfrefactor Oct 16, 2025
ca308a6
chore@small
selfrefactor Oct 19, 2025
cd6a42b
kata
selfrefactor Oct 22, 2025
2b5ff5c
2
selfrefactor Oct 22, 2025
99943e2
3
selfrefactor Oct 22, 2025
53fbaec
chore@small
selfrefactor Oct 28, 2025
8aea806
chore@small
selfrefactor Oct 28, 2025
edbf8c3
chore@small
selfrefactor Nov 3, 2025
d263792
Merge branch 'master' of github.com:selfrefactor/rambda into next-ver…
selfrefactor Nov 3, 2025
fa5f220
chore@small
selfrefactor Nov 6, 2025
8d0f582
chore@small
selfrefactor Nov 18, 2025
edd218c
chore@small
selfrefactor Nov 19, 2025
5a891f8
repl
selfrefactor Nov 19, 2025
b275b0d
chore@small
selfrefactor Nov 19, 2025
a9c2905
chore@small
selfrefactor Nov 22, 2025
b714d9a
chore@small
selfrefactor Nov 22, 2025
abe9779
Merge branch 'master' of github.com:selfrefactor/rambda into next-ver…
selfrefactor Nov 29, 2025
9e30131
feat@fix filter
selfrefactor Nov 29, 2025
1e04d63
readonly on top
selfrefactor Nov 30, 2025
0e25f59
chore@small
selfrefactor Dec 6, 2025
645cbd7
union.with
selfrefactor Dec 9, 2025
001a3b9
chore@small
selfrefactor Dec 20, 2025
5938627
chore@small
selfrefactor Dec 21, 2025
a5938ed
chore@small
selfrefactor Dec 21, 2025
3344649
chore@small
selfrefactor Dec 23, 2025
497854b
chore@small
selfrefactor Dec 23, 2025
9297259
chore@small
selfrefactor Dec 23, 2025
657ef80
chore@small
selfrefactor Dec 23, 2025
8a20f3c
chore@small
selfrefactor Dec 23, 2025
ea4a258
chore@small
selfrefactor Dec 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
11.0.1

- Add missing JS change for `R.includes` and `R.excludes` methods in `11.0.0` release.

11.0.0

- Breaking change: `R.includes` and `R.excludes` now accept list as first argument and value to search as second argument. This makes it more useful when used with `R.filter` and `R.reject`.
Expand Down
83 changes: 39 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,20 +532,19 @@ export function allPass(predicates) {
```javascript
import { allPass } from './allPass.js'
import { filter } from './filter.js'
import { includes } from './includes.js'
import { pipe } from './pipe.js'

const list = [
[1, 2, 3, 4],
[3, 4, 5],
]
test('happy', () => {
const result = pipe(list, filter(allPass([includes(2), includes(3)])))
const result = pipe(list, filter(allPass([x => x.includes(2), x => x.includes(3)])))
expect(result).toEqual([[1, 2, 3, 4]])
})

test('when returns false', () => {
const result = pipe(list, filter(allPass([includes(12), includes(31)])))
const result = pipe(list, filter(allPass([x => x.includes(12), x => x.includes(31)])))
expect(result).toEqual([])
})
```
Expand Down Expand Up @@ -2029,12 +2028,12 @@ difference<T>(x: T[]): (y: T[]) => T[];

```javascript
import { filter } from './filter.js'
import { includes } from './includes.js'
import { excludes } from './excludes.js'

export function difference(x) {
return y => ([
...filter(value => !includes(value)(y))(x),
...filter(value => !includes(value)(x))(y),
export function difference(listA) {
return listB => ([
...filter(value => excludes(listB)(value))(listA),
...filter(value => excludes(listA)(value))(listB),
])
}
```
Expand Down Expand Up @@ -3350,8 +3349,8 @@ excludes<T>(list: readonly T[]): (target: T) => boolean;
```javascript
import { includes } from './includes.js'

export function excludes(valueToFind) {
return iterable => !includes(valueToFind)(iterable)
export function excludes(iterable) {
return valueToFind => !includes(iterable)(valueToFind)
}
```

Expand All @@ -3367,15 +3366,15 @@ import { excludes } from './excludes.js'
test('excludes with string', () => {
const str = 'more is less'

expect(excludes('less')(str)).toBeFalsy()
expect(excludes('never')(str)).toBeTruthy()
expect(excludes(str)('less')).toBeFalsy()
expect(excludes(str)('never')).toBeTruthy()
})

test('excludes with array', () => {
const arr = [1, 2, 3]

expect(excludes(2)(arr)).toBeFalsy()
expect(excludes(4)(arr)).toBeTruthy()
expect(excludes(arr)(2)).toBeFalsy()
expect(excludes(arr)(4)).toBeTruthy()
})
```

Expand Down Expand Up @@ -5034,8 +5033,8 @@ includes(list: readonly string[] | string): (substringToFind: string) => boolean
import { isArray } from './_internals/isArray.js'
import { _indexOf } from './equals.js'

export function includes(valueToFind) {
return iterable => {
export function includes(iterable) {
return valueToFind => {
if (typeof iterable === 'string') {
return iterable.includes(valueToFind)
}
Expand Down Expand Up @@ -5063,30 +5062,30 @@ import { includes } from './includes.js'
test('with string as iterable', () => {
const str = 'foo bar'

expect(includes('bar')(str)).toBeTruthy()
expect(includes('never')(str)).toBeFalsy()
expect(includes(str)('foo')).toBeTruthy()
expect(includes(str)('never')).toBeFalsy()
})

test('with array as iterable', () => {
const arr = [1, 2, 3]

expect(includes(2)(arr)).toBeTruthy()
expect(includes(4)(arr)).toBeFalsy()
expect(includes(arr)(2)).toBeTruthy()
expect(includes(arr)(4)).toBeFalsy()
})

test('with list of objects as iterable', () => {
const arr = [{ a: 1 }, { b: 2 }, { c: 3 }]

expect(includes({ c: 3 })(arr)).toBeTruthy()
expect(includes(arr)({ c: 3 })).toBeTruthy()
})

test('with NaN', () => {
const result = includes(Number.NaN)([Number.NaN])
const result = includes([Number.NaN])(Number.NaN)
expect(result).toBeTruthy()
})

test('with wrong input that does not throw', () => {
const result = includes(1)(/foo/g)
const result = includes([1])(/foo/g)
expect(result).toBeFalsy()
})
```
Expand Down Expand Up @@ -5573,7 +5572,7 @@ import { filter } from './filter.js'
import { includes } from './includes.js'

export function intersection(listA) {
return listB => filter(x => includes(x)(listA))(listB)
return listB => filter(includes(listA))(listB)
}
```

Expand Down Expand Up @@ -11638,13 +11637,13 @@ symmetricDifference<T>(x: T[]): (y: T[]) => T[];

```javascript
import { filter } from './filter.js'
import { includes } from './includes.js'
import { excludes } from './excludes.js'

export function symmetricDifference(x) {
return y => [
...filter(value => !includes(value)(y))(x),
...filter(value => !includes(value)(x))(y),
]
export function symmetricDifference(listA) {
return listB => [
...filter(excludes(listB))(listA),
...filter(excludes(listA))(listB),
]
}
```

Expand Down Expand Up @@ -12777,21 +12776,13 @@ union<T>(x: T[]): (y: T[]) => T[];
<summary><strong>R.union</strong> source</summary>

```javascript
import { cloneList } from './_internals/cloneList.js'
import { includes } from './includes.js'

export function union(x) {
return y => {
const toReturn = cloneList(x)

y.forEach(yInstance => {
if (!includes(yInstance)(x)) {
toReturn.push(yInstance)
}
})
import { excludes } from './excludes.js'

return toReturn
}
export function union(listA) {
return listB => [
...listA,
...listB.filter(excludes(listA)),
]
}
```

Expand Down Expand Up @@ -13982,6 +13973,10 @@ describe('R.zipWith', () => {

## ❯ CHANGELOG

11.0.1

- Add missing JS change for `R.includes` and `R.excludes` methods in `11.0.0` release.

11.0.0

- Breaking change: `R.includes` and `R.excludes` now accept list as first argument and value to search as second argument. This makes it more useful when used with `R.filter` and `R.reject`.
Expand Down
49 changes: 21 additions & 28 deletions dist/rambda.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ function equals(a) {
return b => equalsFn(a, b)
}

function includes(valueToFind) {
return iterable => {
function includes(iterable) {
return valueToFind => {
if (typeof iterable === 'string') {
return iterable.includes(valueToFind)
}
Expand All @@ -497,10 +497,14 @@ function includes(valueToFind) {
}
}

function difference(x) {
return y => ([
...filter(value => !includes(value)(y))(x),
...filter(value => !includes(value)(x))(y),
function excludes(iterable) {
return valueToFind => !includes(iterable)(valueToFind)
}

function difference(listA) {
return listB => ([
...filter(value => excludes(listB)(value))(listA),
...filter(value => excludes(listA)(value))(listB),
])
}

Expand Down Expand Up @@ -636,10 +640,6 @@ function evolve(rules) {
return mapObject((x, prop) => type(rules[prop]) === 'Function' ? rules[prop](x): x)
}

function excludes(valueToFind) {
return iterable => !includes(valueToFind)(iterable)
}

function find(predicate) {
return list => {
let index = 0;
Expand Down Expand Up @@ -951,7 +951,7 @@ function interpolate(input) {
}

function intersection(listA) {
return listB => filter(x => includes(x)(listA))(listB)
return listB => filter(includes(listA))(listB)
}

function _includesWith(pred, x, list) {
Expand Down Expand Up @@ -1669,11 +1669,11 @@ function splitEvery(sliceLength) {
}
}

function symmetricDifference(x) {
return y => [
...filter(value => !includes(value)(y))(x),
...filter(value => !includes(value)(x))(y),
]
function symmetricDifference(listA) {
return listB => [
...filter(excludes(listB))(listA),
...filter(excludes(listA))(listB),
]
}

function tail(listOrString) {
Expand Down Expand Up @@ -1770,18 +1770,11 @@ function tryCatch(fn, fallback) {
}
}

function union(x) {
return y => {
const toReturn = cloneList(x);

y.forEach(yInstance => {
if (!includes(yInstance)(x)) {
toReturn.push(yInstance);
}
});

return toReturn
}
function union(listA) {
return listB => [
...listA,
...listB.filter(excludes(listA)),
]
}

function unionWith(predicate, x) {
Expand Down
49 changes: 21 additions & 28 deletions dist/rambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ function equals(a) {
return b => equalsFn(a, b)
}

function includes(valueToFind) {
return iterable => {
function includes(iterable) {
return valueToFind => {
if (typeof iterable === 'string') {
return iterable.includes(valueToFind)
}
Expand All @@ -495,10 +495,14 @@ function includes(valueToFind) {
}
}

function difference(x) {
return y => ([
...filter(value => !includes(value)(y))(x),
...filter(value => !includes(value)(x))(y),
function excludes(iterable) {
return valueToFind => !includes(iterable)(valueToFind)
}

function difference(listA) {
return listB => ([
...filter(value => excludes(listB)(value))(listA),
...filter(value => excludes(listA)(value))(listB),
])
}

Expand Down Expand Up @@ -634,10 +638,6 @@ function evolve(rules) {
return mapObject((x, prop) => type(rules[prop]) === 'Function' ? rules[prop](x): x)
}

function excludes(valueToFind) {
return iterable => !includes(valueToFind)(iterable)
}

function find(predicate) {
return list => {
let index = 0;
Expand Down Expand Up @@ -949,7 +949,7 @@ function interpolate(input) {
}

function intersection(listA) {
return listB => filter(x => includes(x)(listA))(listB)
return listB => filter(includes(listA))(listB)
}

function _includesWith(pred, x, list) {
Expand Down Expand Up @@ -1667,11 +1667,11 @@ function splitEvery(sliceLength) {
}
}

function symmetricDifference(x) {
return y => [
...filter(value => !includes(value)(y))(x),
...filter(value => !includes(value)(x))(y),
]
function symmetricDifference(listA) {
return listB => [
...filter(excludes(listB))(listA),
...filter(excludes(listA))(listB),
]
}

function tail(listOrString) {
Expand Down Expand Up @@ -1768,18 +1768,11 @@ function tryCatch(fn, fallback) {
}
}

function union(x) {
return y => {
const toReturn = cloneList(x);

y.forEach(yInstance => {
if (!includes(yInstance)(x)) {
toReturn.push(yInstance);
}
});

return toReturn
}
function union(listA) {
return listB => [
...listA,
...listB.filter(excludes(listA)),
]
}

function unionWith(predicate, x) {
Expand Down
Loading