- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 511
Added Record toEntries, fromEntries #1552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
import * as RR from 'fp-ts/ReadonlyRecord'
import * as RA from 'fp-ts/ReadonlyArray'
import * as S from 'fp-ts/Semigroup'
RR.fromFoldable(S.last<string>(), RA.Foldable)([['a', 'b'], ['c', 'd'], ['a', 'e']])
// { a: 'e', c: 'd' } |
@mlegenhausen Didn't realize The other though, I feel like there should be a convenience for, especially considering we could easily auto-type it. Using Assuming we did go with that name, I also think having an alias for |
@bravely sorry overlooked that you just defined an alias for If you could adjust your PR so the IMHO it would be a good addition especially for people who are new |
@mlegenhausen I appreciate the support! I matched the feature in |
Looks good for me could you please add |
@mlegenhausen Apologies for how long it took, but I've added those now. |
@bravely please check the CI result. In this case you need to run |
@mlegenhausen Should be good to go now! |
I just realized I need such helpers. @gcanti Can you please merge it? Thank you. |
src/ReadonlyRecord.ts
Outdated
@@ -29,6 +30,8 @@ import { TraversableWithIndex1 } from './TraversableWithIndex' | |||
import { Unfoldable, Unfoldable1 } from './Unfoldable' | |||
import { PipeableWilt1, PipeableWither1, wiltDefault, Witherable1, witherDefault } from './Witherable' | |||
|
|||
type Semigroup<A> = Se.Semigroup<A> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bravely I believe this can be replaced by
import Semigroup = Se.Semigroup
src/Record.ts
Outdated
@@ -30,6 +31,8 @@ import { TraversableWithIndex1 } from './TraversableWithIndex' | |||
import { Unfoldable, Unfoldable1 } from './Unfoldable' | |||
import { PipeableWilt1, PipeableWither1, wiltDefault, Witherable1, witherDefault } from './Witherable' | |||
|
|||
type Semigroup<A> = Se.Semigroup<A> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
@gcanti Updated! |
Thank you @bravely 👍 |
Record.toEntries
andRecord.fromEntries
, to facilitate a common need of folks coming over from 'normal' JS.