From ee4b09bacb4771a7a82b568f5e63cf6fb7087ab0 Mon Sep 17 00:00:00 2001 From: Deyan Totev Date: Thu, 1 Feb 2024 08:03:14 +0200 Subject: [PATCH] chore@small --- .eggignore | 1 - ISSUE_TEMPLATE.md | 6 -- docs/README.md | 58 ++++++++++++++++--- CONTRIBUTING.md => files/CONTRIBUTING.md | 0 .../NEXT_VERSION_CHECKLIST.md | 0 compare-size.js => files/compare-size.js | 0 files/index.d.ts | 30 ++++++++++ source/mergeDeepLeft.spec.js | 58 ++++++++++--------- source/pickBy.spec.js | 1 - 9 files changed, 111 insertions(+), 43 deletions(-) delete mode 100644 .eggignore delete mode 100644 ISSUE_TEMPLATE.md rename CONTRIBUTING.md => files/CONTRIBUTING.md (100%) rename NEXT_VERSION_CHECKLIST.md => files/NEXT_VERSION_CHECKLIST.md (100%) rename compare-size.js => files/compare-size.js (100%) diff --git a/.eggignore b/.eggignore deleted file mode 100644 index d2f2fab52..000000000 --- a/.eggignore +++ /dev/null @@ -1 +0,0 @@ -extends .gitignore diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md deleted file mode 100644 index c93594edd..000000000 --- a/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,6 +0,0 @@ -### Issue - - -### Rambda version - -### Node.js version diff --git a/docs/README.md b/docs/README.md index a2ff57c64..b6c219704 100644 --- a/docs/README.md +++ b/docs/README.md @@ -106,25 +106,19 @@ One of the main issues with `Ramda` is the slow process of releasing new version
- Click to see the full list of 51 Ramda methods not implemented in Rambda and their status. + Click to see the full list of 43 Ramda methods not implemented in Rambda and their status. -- insert -- insertAll - into - invert - invertObj - invoker -- isNotNil - keysIn - lift - liftN -- lt -- lte - mapAccum - mapAccumRight - memoizeWith -- mergeDeepLeft - mergeDeepWith - mergeDeepWithKey - mergeWithKey @@ -135,7 +129,6 @@ One of the main issues with `Ramda` is the slow process of releasing new version - pair - partialRight - pathSatisfies -- pickBy - pipeWith - project - promap @@ -146,7 +139,6 @@ One of the main issues with `Ramda` is the slow process of releasing new version - scan - sequence - splitWhenever -- swap - symmetricDifferenceWith - andThen - toPairsIn @@ -6531,6 +6523,14 @@ It returns a new list by applying a `predicate` function to all elements of `lis [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#innerJoin) +### insert + +[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#insert) + +### insertAll + +[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#insertAll) + ### intersection It loops through `listA` and `listB` and returns the intersection of the two according to `R.equals`. @@ -6700,6 +6700,10 @@ test('happy', () => { [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#isNil) +### isNotNil + +[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#isNotNil) + ### join ```typescript @@ -7542,6 +7546,12 @@ test('get (set(set s v1) v2) === v2', () => { [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lensProp) +### lt + +Try this R.lt example in Rambda REPL + +[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lt) + ### map ```typescript @@ -8267,6 +8277,10 @@ describe('R.mergeAll', () => { [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mergeAll) +### mergeDeepLeft + +[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mergeDeepLeft) + ### mergeDeepRight ```typescript @@ -11077,6 +11091,10 @@ describe('R.paths', () => { [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#paths) +### pathSatisfies + +[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pathSatisfies) + ### pick ```typescript @@ -11447,6 +11465,10 @@ describe('R.pickAll with string as props input', () => { [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pickAll) +### pickBy + +[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pickBy) + ### pipe It performs left-to-right function composition. @@ -14134,6 +14156,10 @@ test('happy', () => { [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#sum) +### swap + +[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#swap) + ### symmetricDifference ```typescript @@ -17250,6 +17276,20 @@ describe('R.zipWith', () => { ## ❯ CHANGELOG +9.1.0 + +Add these methods + +- insert +- insertAll +- lt +- lte +- isNotNil +- pickBy +- pathSatisfies +- swap +- mergeDeepLeft + 9.0.1 - Fix bad TS typings, due to missing declaration - [Issue #716](https://github.com/selfrefactor/rambda/issues/716) diff --git a/CONTRIBUTING.md b/files/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to files/CONTRIBUTING.md diff --git a/NEXT_VERSION_CHECKLIST.md b/files/NEXT_VERSION_CHECKLIST.md similarity index 100% rename from NEXT_VERSION_CHECKLIST.md rename to files/NEXT_VERSION_CHECKLIST.md diff --git a/compare-size.js b/files/compare-size.js similarity index 100% rename from compare-size.js rename to files/compare-size.js diff --git a/files/index.d.ts b/files/index.d.ts index 27236cb4f..85972813e 100644 --- a/files/index.d.ts +++ b/files/index.d.ts @@ -6018,6 +6018,9 @@ Explanation: Example: ``` +const list = ['a', 'b', 'c', 'd', 'e']; +const result = R.insert(2, 'x', list); +// => ['a', 'b', 'x', 'c', 'd', 'e'] ``` Categories: @@ -6038,6 +6041,9 @@ Explanation: Example: ``` +const list = ['a', 'b', 'c', 'd', 'e']; +const result = R.insertAll(2, ['x', 'y', 'z'], list); +// => ['a', 'b', 'x', 'y', 'z', 'c', 'd', 'e'] ``` Categories: @@ -6058,6 +6064,12 @@ Explanation: Example: ``` +const result = [ + R.isNotNil(null), + R.isNotNil(undefined), + R.isNotNil([]), +] +// => [false, false, true] ``` Categories: @@ -6076,6 +6088,11 @@ Explanation: Example: ``` +const result = R.pickBy( + x => x > 1, + {a: 1, b: 2, c: 3} +) +// => {b: 2, c: 3} ``` Categories: @@ -6095,6 +6112,12 @@ Explanation: Example: ``` +const result = R.pathSatisfies( + x => x > 0, + ['a', 'b', 'c'], + {a: {b: {c: 1}}} +) +// => true ``` Categories: @@ -6114,6 +6137,8 @@ Explanation: Example: ``` +const result = R.swap(1, 2, [1, 2, 3]) +// => [1, 3, 2] ``` Categories: @@ -6133,6 +6158,11 @@ Explanation: Example: ``` +const result = R.mergeDeepLeft( + {a: {b: 1}}, + {a: {b: 2, c: 3}} +) +// => {a: {b: 1, c: 3}} ``` Categories: diff --git a/source/mergeDeepLeft.spec.js b/source/mergeDeepLeft.spec.js index 316bc3dd6..891342172 100644 --- a/source/mergeDeepLeft.spec.js +++ b/source/mergeDeepLeft.spec.js @@ -1,30 +1,36 @@ -import { mergeDeepLeft } from './mergeDeepLeft' -import { mergeDeepLeft as mergeDeepLeftRamda } from 'ramda' +import { mergeDeepLeft } from './mergeDeepLeft'; -it('takes two objects, recursively merges their own properties and returns a new object', function () { - var a = {w: 1, x: 2, y: {z: 3}} - var b = {a: 4, b: 5, c: {d: 6}} - expect(mergeDeepLeft(a, b)).toEqual({w: 1, x: 2, y: {z: 3}, a: 4, b: 5, c: {d: 6}}) -}) +it('takes two objects, recursively merges their own properties and returns a new object', () => { + const a = { w: 1, x: 2, y: { z: 3 } }; + const b = { a: 4, b: 5, c: { d: 6 } }; + expect(mergeDeepLeft(a, b)).toEqual({ + w: 1, + x: 2, + y: { z: 3 }, + a: 4, + b: 5, + c: { d: 6 }, + }); +}); -it('overrides properties in the second object with properties in the first object', function () { - var a = {a: {b: 1, c: 2}, y: 0} - var b = {a: {b: 3, d: 4}, z: 0} - expect(mergeDeepLeft(a, b)).toEqual({a: {b: 1, c: 2, d: 4}, y: 0, z: 0}) -}) +it('overrides properties in the second object with properties in the first object', () => { + const a = { a: { b: 1, c: 2 }, y: 0 }; + const b = { a: { b: 3, d: 4 }, z: 0 }; + expect(mergeDeepLeft(a, b)).toEqual({ a: { b: 1, c: 2, d: 4 }, y: 0, z: 0 }); +}); -it('is not destructive', function () { - var a = {w: 1, x: {y: 2}} - var res = mergeDeepLeft(a, {x: {y: 3}}) - expect(a).not.toBe(res) - expect(a.x).not.toBe(res.x) - expect(res).toEqual({w: 1, x: {y: 2}}) -}) +it('is not destructive', () => { + const a = { w: 1, x: { y: 2 } }; + const res = mergeDeepLeft(a, { x: { y: 3 } }); + expect(a).not.toBe(res); + expect(a.x).not.toBe(res.x); + expect(res).toEqual({ w: 1, x: { y: 2 } }); +}); -it('reports only own properties', function () { - var a = {w: 1, x: {y: 2}} - function Cla() {} - Cla.prototype.y = 5 - expect(mergeDeepLeft({x: new Cla()}, a)).toEqual({w: 1, x: {y: 2}}) - expect(mergeDeepLeft(a, {x: new Cla()})).toEqual({w: 1, x: {y: 2}}) -}) +it('reports only own properties', () => { + const a = { w: 1, x: { y: 2 } }; + function Cla() {} + Cla.prototype.y = 5; + expect(mergeDeepLeft({ x: new Cla() }, a)).toEqual({ w: 1, x: { y: 2 } }); + expect(mergeDeepLeft(a, { x: new Cla() })).toEqual({ w: 1, x: { y: 2 } }); +}); diff --git a/source/pickBy.spec.js b/source/pickBy.spec.js index 4a73f6462..8eeecb2ac 100644 --- a/source/pickBy.spec.js +++ b/source/pickBy.spec.js @@ -1,6 +1,5 @@ import { T, always } from 'rambdax' import { pickBy } from './pickBy' -import { pickBy as pickByRamda } from 'ramda' var obj = {a: 1, b: 2, c: 3, d: 4, e: 5, f: 6}