diff --git a/.github/README.md b/.github/README.md index 59219715..64932997 100644 --- a/.github/README.md +++ b/.github/README.md @@ -2918,13 +2918,15 @@ differenceWith( import { curry } from './curry.js' import { _indexOf } from './equals.js' -export function differenceWithFn(fn, a, b) { - let willReturn = [] - let [first, second] = a.length > b.length ? [a, b] : [b, a] +export function differenceWithFn( + fn, a, b +){ + const willReturn = [] + const [ first, second ] = a.length > b.length ? [ a, b ] : [ b, a ] first.forEach(item => { - let hasItem = second.some(secondItem => fn(item, secondItem)) - if (!hasItem && _indexOf(item, willReturn) === -1) { + const hasItem = second.some(secondItem => fn(item, secondItem)) + if (!hasItem && _indexOf(item, willReturn) === -1){ willReturn.push(item) } }) @@ -2932,7 +2934,7 @@ export function differenceWithFn(fn, a, b) { return willReturn } -export let differenceWith = curry(differenceWithFn) +export const differenceWith = curry(differenceWithFn) ``` @@ -2942,14 +2944,18 @@ export let differenceWith = curry(differenceWithFn) Tests ```javascript -import { differenceWith } from './differenceWith' +import { differenceWith } from './differenceWith.js' test('happy', () => { - var foo = [{a: 1}, {a: 2}, {a: 3}]; - var bar = [{a: 3}, {a: 4}]; - var fn = function(r, s) { return r.a === s.a; } - const result = differenceWith(fn, foo, bar) - expect(result).toEqual([{a: 1}, {a: 2}]) + const foo = [ { a : 1 }, { a : 2 }, { a : 3 } ] + const bar = [ { a : 3 }, { a : 4 } ] + const fn = function (r, s){ + return r.a === s.a + } + const result = differenceWith( + fn, foo, bar + ) + expect(result).toEqual([ { a : 1 }, { a : 2 } ]) }) ``` @@ -18422,6 +18428,12 @@ describe('R.zipWith', () => { ## ❯ CHANGELOG +8.1.0 + +- Fix input order of TS definitions for `R.propEq` method - [Issue #688](https://github.com/selfrefactor/rambda/issues/688) + +- Add `R.differenceWith` method - [Issue #91](https://github.com/selfrefactor/rambdax/issues/91) + 8.0.0 - handle falsy values in merge methods - https://github.com/ramda/ramda/pull/3222 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6af23647..5651e5a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +8.1.0 + +- Fix input order of TS definitions for `R.propEq` method - [Issue #688](https://github.com/selfrefactor/rambda/issues/688) + +- Add `R.differenceWith` method - [Issue #91](https://github.com/selfrefactor/rambdax/issues/91) + 8.0.0 - handle falsy values in merge methods - https://github.com/ramda/ramda/pull/3222 diff --git a/NEXT_VERSION_CHECKLIST.md b/NEXT_VERSION_CHECKLIST.md index e5d17b26..feaa61de 100644 --- a/NEXT_VERSION_CHECKLIST.md +++ b/NEXT_VERSION_CHECKLIST.md @@ -1,3 +1,7 @@ > Idea of this file is to store CHANGELOG changes until MR is ready to be opened. -differenceWith \ No newline at end of file +differenceWith + +--- +try omitPath as method instead of multiple paths +--- diff --git a/README.md b/README.md index c112a84d..b332d5b9 100644 --- a/README.md +++ b/README.md @@ -2772,13 +2772,15 @@ differenceWith( import { curry } from './curry.js' import { _indexOf } from './equals.js' -export function differenceWithFn(fn, a, b) { - let willReturn = [] - let [first, second] = a.length > b.length ? [a, b] : [b, a] +export function differenceWithFn( + fn, a, b +){ + const willReturn = [] + const [ first, second ] = a.length > b.length ? [ a, b ] : [ b, a ] first.forEach(item => { - let hasItem = second.some(secondItem => fn(item, secondItem)) - if (!hasItem && _indexOf(item, willReturn) === -1) { + const hasItem = second.some(secondItem => fn(item, secondItem)) + if (!hasItem && _indexOf(item, willReturn) === -1){ willReturn.push(item) } }) @@ -2786,7 +2788,7 @@ export function differenceWithFn(fn, a, b) { return willReturn } -export let differenceWith = curry(differenceWithFn) +export const differenceWith = curry(differenceWithFn) ``` @@ -2796,14 +2798,18 @@ export let differenceWith = curry(differenceWithFn) Tests ```javascript -import { differenceWith } from './differenceWith' +import { differenceWith } from './differenceWith.js' test('happy', () => { - var foo = [{a: 1}, {a: 2}, {a: 3}]; - var bar = [{a: 3}, {a: 4}]; - var fn = function(r, s) { return r.a === s.a; } - const result = differenceWith(fn, foo, bar) - expect(result).toEqual([{a: 1}, {a: 2}]) + const foo = [ { a : 1 }, { a : 2 }, { a : 3 } ] + const bar = [ { a : 3 }, { a : 4 } ] + const fn = function (r, s){ + return r.a === s.a + } + const result = differenceWith( + fn, foo, bar + ) + expect(result).toEqual([ { a : 1 }, { a : 2 } ]) }) ``` @@ -17146,6 +17152,12 @@ describe('R.zipWith', () => { ## ❯ CHANGELOG +8.1.0 + +- Fix input order of TS definitions for `R.propEq` method - [Issue #688](https://github.com/selfrefactor/rambda/issues/688) + +- Add `R.differenceWith` method - [Issue #91](https://github.com/selfrefactor/rambdax/issues/91) + 8.0.0 - handle falsy values in merge methods - https://github.com/ramda/ramda/pull/3222 diff --git a/dist/rambda.js b/dist/rambda.js index eec64e1e..1ca1ac7b 100644 --- a/dist/rambda.js +++ b/dist/rambda.js @@ -728,17 +728,17 @@ function difference(a, b) { } function differenceWithFn(fn, a, b) { - let willReturn = []; - let [first, second] = a.length > b.length ? [a, b] : [b, a]; + const willReturn = []; + const [first, second] = a.length > b.length ? [a, b] : [b, a]; first.forEach(item => { - let hasItem = second.some(secondItem => fn(item, secondItem)); + const hasItem = second.some(secondItem => fn(item, secondItem)); if (!hasItem && _indexOf(item, willReturn) === -1) { willReturn.push(item); } }); return willReturn; } -let differenceWith = curry(differenceWithFn); +const differenceWith = curry(differenceWithFn); function dissoc(prop, obj) { if (arguments.length === 1) return _obj => dissoc(prop, _obj); diff --git a/rambda.js b/rambda.js index 61f318f6..af8975d1 100644 --- a/rambda.js +++ b/rambda.js @@ -1,4 +1,6 @@ /// +export * from './src/F.js' +export * from './src/T.js' export * from './src/add.js' export * from './src/adjust.js' export * from './src/all.js' @@ -43,7 +45,6 @@ export * from './src/endsWith.js' export * from './src/eqProps.js' export * from './src/equals.js' export * from './src/evolve.js' -export * from './src/F.js' export * from './src/filter.js' export * from './src/find.js' export * from './src/findIndex.js' @@ -129,8 +130,8 @@ export * from './src/prop.js' export * from './src/propEq.js' export * from './src/propIs.js' export * from './src/propOr.js' -export * from './src/props.js' export * from './src/propSatisfies.js' +export * from './src/props.js' export * from './src/range.js' export * from './src/reduce.js' export * from './src/reject.js' @@ -149,7 +150,6 @@ export * from './src/startsWith.js' export * from './src/subtract.js' export * from './src/sum.js' export * from './src/symmetricDifference.js' -export * from './src/T.js' export * from './src/tail.js' export * from './src/take.js' export * from './src/takeLast.js' diff --git a/src/differenceWith.js b/src/differenceWith.js index 3b04536b..407c3e6a 100644 --- a/src/differenceWith.js +++ b/src/differenceWith.js @@ -1,13 +1,15 @@ import { curry } from './curry.js' import { _indexOf } from './equals.js' -export function differenceWithFn(fn, a, b) { - let willReturn = [] - let [first, second] = a.length > b.length ? [a, b] : [b, a] +export function differenceWithFn( + fn, a, b +){ + const willReturn = [] + const [ first, second ] = a.length > b.length ? [ a, b ] : [ b, a ] first.forEach(item => { - let hasItem = second.some(secondItem => fn(item, secondItem)) - if (!hasItem && _indexOf(item, willReturn) === -1) { + const hasItem = second.some(secondItem => fn(item, secondItem)) + if (!hasItem && _indexOf(item, willReturn) === -1){ willReturn.push(item) } }) @@ -15,4 +17,4 @@ export function differenceWithFn(fn, a, b) { return willReturn } -export let differenceWith = curry(differenceWithFn) \ No newline at end of file +export const differenceWith = curry(differenceWithFn)