Skip to content

Commit

Permalink
chore@small
Browse files Browse the repository at this point in the history
  • Loading branch information
Deyan Totev committed Feb 1, 2024
1 parent 0276cac commit ee4b09b
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 43 deletions.
1 change: 0 additions & 1 deletion .eggignore

This file was deleted.

6 changes: 0 additions & 6 deletions ISSUE_TEMPLATE.md

This file was deleted.

58 changes: 49 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,19 @@ One of the main issues with `Ramda` is the slow process of releasing new version

<details>
<summary>
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.
</summary>

- insert
- insertAll
- into
- invert
- invertObj
- invoker
- isNotNil
- keysIn
- lift
- liftN
- lt
- lte
- mapAccum
- mapAccumRight
- memoizeWith
- mergeDeepLeft
- mergeDeepWith
- mergeDeepWithKey
- mergeWithKey
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -7542,6 +7546,12 @@ test('get (set(set s v1) v2) === v2', () => {

[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lensProp)

### lt

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20result%20%3D%20%5BR.lt(2%2C%201)%2C%20R.lt(2%2C%203)%5D%0A%2F%2F%20%3D%3E%20%5Bfalse%2C%20true%5D">Try this <strong>R.lt</strong> example in Rambda REPL</a>

[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lt)

### map

```typescript
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions files/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -6058,6 +6064,12 @@ Explanation:
Example:
```
const result = [
R.isNotNil(null),
R.isNotNil(undefined),
R.isNotNil([]),
]
// => [false, false, true]
```
Categories:
Expand All @@ -6076,6 +6088,11 @@ Explanation:
Example:
```
const result = R.pickBy(
x => x > 1,
{a: 1, b: 2, c: 3}
)
// => {b: 2, c: 3}
```
Categories:
Expand All @@ -6095,6 +6112,12 @@ Explanation:
Example:
```
const result = R.pathSatisfies(
x => x > 0,
['a', 'b', 'c'],
{a: {b: {c: 1}}}
)
// => true
```
Categories:
Expand All @@ -6114,6 +6137,8 @@ Explanation:
Example:
```
const result = R.swap(1, 2, [1, 2, 3])
// => [1, 3, 2]
```
Categories:
Expand All @@ -6133,6 +6158,11 @@ Explanation:
Example:
```
const result = R.mergeDeepLeft(
{a: {b: 1}},
{a: {b: 2, c: 3}}
)
// => {a: {b: 1, c: 3}}
```
Categories:
Expand Down
58 changes: 32 additions & 26 deletions source/mergeDeepLeft.spec.js
Original file line number Diff line number Diff line change
@@ -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 } });
});
1 change: 0 additions & 1 deletion source/pickBy.spec.js
Original file line number Diff line number Diff line change
@@ -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}

Expand Down

0 comments on commit ee4b09b

Please sign in to comment.