Skip to content

Commit

Permalink
chore@small
Browse files Browse the repository at this point in the history
  • Loading branch information
selfrefactor committed Oct 24, 2024
1 parent fdb9b59 commit 1a17f8b
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 29 deletions.
39 changes: 27 additions & 12 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1857,7 +1857,7 @@ describe('applySpec', () => {

### ascend

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20result%20%3D%20R.sort(%0A%20%20R.ascend(x%20%3D%3E%20x)%2C%0A%20%20%5B2%2C%201%5D%0A)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D">Try this <strong>R.ascend</strong> example in Rambda REPL</a>
<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20result%20%3D%20R.sort(R.descend(x%20%3D%3E%20x)%2C%20%5B2%2C%201%5D)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D">Try this <strong>R.ascend</strong> example in Rambda REPL</a>

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

Expand Down Expand Up @@ -1967,7 +1967,7 @@ export const assocPath = curry(assocPathFn)
```javascript
import { assocPathFn } from './assocPath.js'

test.only('happy', () => {
test('happy', () => {
const path = 'a.c.1'
const input = {
a : {
Expand Down Expand Up @@ -2008,7 +2008,7 @@ test('string can be used as path input', () => {

test('difference with ramda - doesn\'t overwrite primitive values with keys in the path', () => {
const obj = { a : 'str' }
const result = assocPath(
const result = assocPathFn(
[ 'a', 'b' ], 42, obj
)

Expand All @@ -2022,7 +2022,18 @@ test('difference with ramda - doesn\'t overwrite primitive values with keys in t
})
})

test('bug', () => {
test('bug 748', () => {
/*
https://github.com/selfrefactor/rambda/issues/748
*/
const obj = {};
let result = assocPathFn(['a', '2'], 3, obj)
let result1 = assocPath(['a', '2'], 3, obj)
console.log({result})
console.log(result1)
})

test('bug 524', () => {
/*
https://github.com/selfrefactor/rambda/issues/524
*/
Expand Down Expand Up @@ -3038,7 +3049,7 @@ describe('R.defaultTo with Ramda spec', () => {

### descend

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?R.sort(%0A%20%20R.descend(x%20%3D%3E%20x)%2C%0A%20%20%5B1%2C%202%5D%0Aconst%20result%20%3D%20)%0A%2F%2F%20%3D%3E%20%5B2%2C%201%5D">Try this <strong>R.descend</strong> example in Rambda REPL</a>
<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20result%20%3D%20R.sort(R.descend(x%20%3D%3E%20x)%2C%20%5B1%2C%202%5D)%0A%2F%2F%20%3D%3E%20%5B2%2C%201%5D">Try this <strong>R.descend</strong> example in Rambda REPL</a>

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

Expand Down Expand Up @@ -5951,7 +5962,7 @@ It splits `list` according to a provided `groupFn` function and returns an objec

It returns separated version of list or string `input`, where separation is done with equality `compareFn` function.

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20compareFn%20%3D%20(x%2C%20y)%20%3D%3E%20x%20%3D%3D%3D%20y%0Aconst%20list%20%3D%20%5B1%2C%202%2C%202%2C%201%2C%201%2C%202%5D%0A%0Aconst%20result%20%3D%20R.groupWith(isConsecutive%2C%20list)%0A%2F%2F%20%3D%3E%20%5B%5B1%5D%2C%20%5B2%2C2%5D%2C%20%5B1%2C1%5D%2C%20%5B2%5D%5D">Try this <strong>R.groupWith</strong> example in Rambda REPL</a>
<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20isConsecutive%20%3D%20(x%2C%20y)%20%3D%3E%20x%20%3D%3D%3D%20y%0Aconst%20list%20%3D%20%5B1%2C%202%2C%202%2C%201%2C%201%2C%202%5D%0A%0Aconst%20result%20%3D%20R.groupWith(isConsecutive%2C%20list)%0A%2F%2F%20%3D%3E%20%5B%5B1%5D%2C%20%5B2%2C2%5D%2C%20%5B1%2C1%5D%2C%20%5B2%5D%5D">Try this <strong>R.groupWith</strong> example in Rambda REPL</a>

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

Expand Down Expand Up @@ -8090,13 +8101,13 @@ const iterable = [1, 2]
const obj = {a: 1, b: 2}

const result = [
R.map(fn, list),
R.map(fnWhenObject, Record<string, unknown>)
R.map(fn, iterable),
R.map(fnWhenObject, obj)
]
// => [ [1, 4], {a: 'a-1', b: 'b-2'}]
// => [ [2, 4], {a: 'a-1', b: 'b-2'}]
```

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20fn%20%3D%20x%20%3D%3E%20x%20*%202%0Aconst%20fnWhenObject%20%3D%20(val%2C%20prop)%3D%3E%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20iterable%20%3D%20%5B1%2C%202%5D%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20%5B%20%0A%20%20R.map(fn%2C%20list)%2C%0A%20%20R.map(fnWhenObject%2C%20Record%3Cstring%2C%20unknown%3E)%0A%5D%0A%2F%2F%20%3D%3E%20%5B%20%5B1%2C%204%5D%2C%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D%5D">Try this <strong>R.map</strong> example in Rambda REPL</a>
<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20fn%20%3D%20x%20%3D%3E%20x%20*%202%0Aconst%20fnWhenObject%20%3D%20(val%2C%20prop)%3D%3E%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20iterable%20%3D%20%5B1%2C%202%5D%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20%5B%20%0A%20%20R.map(fn%2C%20iterable)%2C%0A%20%20R.map(fnWhenObject%2C%20obj)%0A%5D%0A%2F%2F%20%3D%3E%20%5B%20%5B2%2C%204%5D%2C%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D%5D">Try this <strong>R.map</strong> example in Rambda REPL</a>

<details>

Expand Down Expand Up @@ -8345,11 +8356,11 @@ const fn = (val, prop) => {

const obj = {a: 1, b: 2}

const result = R.map(mapObjIndexed, Record<string, unknown>)
const result = R.mapObjIndexed(fn, obj)
// => {a: 'a-1', b: 'b-2'}
```

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20fn%20%3D%20(val%2C%20prop)%20%3D%3E%20%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20R.map(mapObjIndexed%2C%20Record%3Cstring%2C%20unknown%3E)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D">Try this <strong>R.mapObjIndexed</strong> example in Rambda REPL</a>
<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20fn%20%3D%20(val%2C%20prop)%20%3D%3E%20%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20R.mapObjIndexed(fn%2C%20obj)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D">Try this <strong>R.mapObjIndexed</strong> example in Rambda REPL</a>

<details>

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

## ❯ CHANGELOG

9.4.0

- Fix `deno` release

9.3.0

- Breaking change in relation to TS typings of `R.assoc`, `R.dissoc` and `R.modify` - https://github.com/ramda/types/pull/37
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
9.4.0

- Fix `deno` release

9.3.0

- Breaking change in relation to TS typings of `R.assoc`, `R.dissoc` and `R.modify` - https://github.com/ramda/types/pull/37
Expand Down
31 changes: 23 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@ describe('applySpec', () => {

### ascend

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20result%20%3D%20R.sort(%0A%20%20R.ascend(x%20%3D%3E%20x)%2C%0A%20%20%5B2%2C%201%5D%0A)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D">Try this <strong>R.ascend</strong> example in Rambda REPL</a>
<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20result%20%3D%20R.sort(R.descend(x%20%3D%3E%20x)%2C%20%5B2%2C%201%5D)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D">Try this <strong>R.ascend</strong> example in Rambda REPL</a>

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

Expand Down Expand Up @@ -1865,7 +1865,7 @@ export const assocPath = curry(assocPathFn)
```javascript
import { assocPathFn } from './assocPath.js'

test.only('happy', () => {
test('happy', () => {
const path = 'a.c.1'
const input = {
a : {
Expand Down Expand Up @@ -1906,7 +1906,7 @@ test('string can be used as path input', () => {

test('difference with ramda - doesn\'t overwrite primitive values with keys in the path', () => {
const obj = { a : 'str' }
const result = assocPath(
const result = assocPathFn(
[ 'a', 'b' ], 42, obj
)

Expand All @@ -1920,7 +1920,18 @@ test('difference with ramda - doesn\'t overwrite primitive values with keys in t
})
})

test('bug', () => {
test('bug 748', () => {
/*
https://github.com/selfrefactor/rambda/issues/748
*/
const obj = {};
let result = assocPathFn(['a', '2'], 3, obj)
let result1 = assocPath(['a', '2'], 3, obj)
console.log({result})
console.log(result1)
})

test('bug 524', () => {
/*
https://github.com/selfrefactor/rambda/issues/524
*/
Expand Down Expand Up @@ -2884,7 +2895,7 @@ describe('R.defaultTo with Ramda spec', () => {

### descend

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?R.sort(%0A%20%20R.descend(x%20%3D%3E%20x)%2C%0A%20%20%5B1%2C%202%5D%0Aconst%20result%20%3D%20)%0A%2F%2F%20%3D%3E%20%5B2%2C%201%5D">Try this <strong>R.descend</strong> example in Rambda REPL</a>
<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20result%20%3D%20R.sort(R.descend(x%20%3D%3E%20x)%2C%20%5B1%2C%202%5D)%0A%2F%2F%20%3D%3E%20%5B2%2C%201%5D">Try this <strong>R.descend</strong> example in Rambda REPL</a>

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

Expand Down Expand Up @@ -5631,7 +5642,7 @@ It splits `list` according to a provided `groupFn` function and returns an objec

It returns separated version of list or string `input`, where separation is done with equality `compareFn` function.

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20isConsecutive%20%3D%20%28x%2C%20y%29%20%3D%3E%20x%20%3D%3D%3D%20y%0Aconst%20list%20%3D%20%5B1%2C%202%2C%202%2C%201%2C%201%2C%202%5D%0A%0Aconst%20result%20%3D%20R.groupWith%28isConsecutive%2C%20list%29%0A%2F%2F%20%3D%3E%20%5B%5B1%5D%2C%20%5B2%2C2%5D%2C%20%5B1%2C1%5D%2C%20%5B2%5D%5D">Try this <strong>R.groupWith</strong> example in Rambda REPL</a>
<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20isConsecutive%20%3D%20(x%2C%20y)%20%3D%3E%20x%20%3D%3D%3D%20y%0Aconst%20list%20%3D%20%5B1%2C%202%2C%202%2C%201%2C%201%2C%202%5D%0A%0Aconst%20result%20%3D%20R.groupWith(isConsecutive%2C%20list)%0A%2F%2F%20%3D%3E%20%5B%5B1%5D%2C%20%5B2%2C2%5D%2C%20%5B1%2C1%5D%2C%20%5B2%5D%5D">Try this <strong>R.groupWith</strong> example in Rambda REPL</a>

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

Expand Down Expand Up @@ -7601,7 +7612,7 @@ It returns the result of looping through `iterable` with `fn`.

It works with both array and object.

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh/?const%20fn%20%3D%20x%20%3D%3E%20x%20%2A%202%0Aconst%20fnWhenObject%20%3D%20%28val%2C%20prop%29%3D%3E%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20iterable%20%3D%20%5B1%2C%202%5D%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20%5B%20%0A%20%20R.map%28fn%2C%20iterable%29%2C%0A%20%20R.map%28fnWhenObject%2C%20obj%29%0A%5D%0A%2F%2F%20%3D%3E%20%5B%20%5B2%2C%204%5D%2C%20%7Ba%3A%20%27a-1%27%2C%20b%3A%20%27b-2%27%7D%5D">Try this <strong>R.map</strong> example in Rambda REPL</a>
<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20fn%20%3D%20x%20%3D%3E%20x%20*%202%0Aconst%20fnWhenObject%20%3D%20(val%2C%20prop)%3D%3E%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20iterable%20%3D%20%5B1%2C%202%5D%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20%5B%20%0A%20%20R.map(fn%2C%20iterable)%2C%0A%20%20R.map(fnWhenObject%2C%20obj)%0A%5D%0A%2F%2F%20%3D%3E%20%5B%20%5B2%2C%204%5D%2C%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D%5D">Try this <strong>R.map</strong> example in Rambda REPL</a>

<details>

Expand Down Expand Up @@ -7843,7 +7854,7 @@ mapObjIndexed<T>(fn: ObjectIterator<T, T>, iterable: Dictionary<T>): Dictionary<

It works the same way as `R.map` does for objects. It is added as Ramda also has this method.

<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20fn%20%3D%20%28val%2C%20prop%29%20%3D%3E%20%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20R.mapObjIndexed%28fn%2C%20obj%29%0A%2F%2F%20%3D%3E%20%7Ba%3A%20%27a-1%27%2C%20b%3A%20%27b-2%27%7D">Try this <strong>R.mapObjIndexed</strong> example in Rambda REPL</a>
<a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20fn%20%3D%20(val%2C%20prop)%20%3D%3E%20%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20R.mapObjIndexed(fn%2C%20obj)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D">Try this <strong>R.mapObjIndexed</strong> example in Rambda REPL</a>

<details>

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

## ❯ CHANGELOG

9.4.0

- Fix `deno` release

9.3.0

- Breaking change in relation to TS typings of `R.assoc`, `R.dissoc` and `R.modify` - https://github.com/ramda/types/pull/37
Expand Down
2 changes: 1 addition & 1 deletion dist/rambda.umd.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions files/NEXT_VERSION_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Change `R.groupBy` typings to match `@types/ramda` typings
---
ABOVE IS DONE
---
share about bug with assocpath

update Rambdax and release to now
https://github.com/selfrefactor/rambda/pull/744
Expand Down
6 changes: 2 additions & 4 deletions immutable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,8 @@ export function fromPairs<V>(listOfPairs: readonly ((readonly [string, V]))[]):
/**
* It splits `list` according to a provided `groupFn` function and returns an object.
*/
export function groupBy<T>(groupFn: (x: T) => string, list: readonly T[]): { readonly [index: string]: readonly T[] };
export function groupBy<T>(groupFn: (x: T) => string): (list: readonly T[]) => { readonly [index: string]: readonly T[] };
export function groupBy<T, U>(groupFn: (x: T) => string, list: readonly T[]): U;
export function groupBy<T, U>(groupFn: (x: T) => string): (list: readonly T[]) => U;
export function groupBy<T, K extends string = string>(fn: (a: T) => K): (list: readonly T[]) => Partial<Record<K, readonly T[]>>;
export function groupBy<T, K extends string = string>(fn: (a: T) => K, list: readonly T[]): Partial<Record<K, readonly T[]>>;

/**
* It returns separated version of list or string `input`, where separation is done with equality `compareFn` function.
Expand Down
6 changes: 2 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,8 @@ export function fromPairs<V>(listOfPairs: ([string, V])[]): { [index: string]: V
/**
* It splits `list` according to a provided `groupFn` function and returns an object.
*/
export function groupBy<T>(groupFn: (x: T) => string, list: T[]): { [index: string]: T[] };
export function groupBy<T>(groupFn: (x: T) => string): (list: T[]) => { [index: string]: T[] };
export function groupBy<T, U>(groupFn: (x: T) => string, list: T[]): U;
export function groupBy<T, U>(groupFn: (x: T) => string): (list: T[]) => U;
export function groupBy<T, K extends string = string>(fn: (a: T) => K): (list: T[]) => Partial<Record<K, T[]>>;
export function groupBy<T, K extends string = string>(fn: (a: T) => K, list: T[]): Partial<Record<K, T[]>>;

/**
* It returns separated version of list or string `input`, where separation is done with equality `compareFn` function.
Expand Down

0 comments on commit 1a17f8b

Please sign in to comment.