Coder Social home page Coder Social logo

Add `mapAccum` about remeda HOT 5 CLOSED

ludwignagelhus avatar ludwignagelhus commented on June 2, 2024
Add `mapAccum`

from remeda.

Comments (5)

cjquines avatar cjquines commented on June 2, 2024

you might be looking for https://remedajs.com/docs/#mapWithFeedback

(it's not quite that, but it can be easily built from that)

from remeda.

ludwignagelhus avatar ludwignagelhus commented on June 2, 2024

I'm looking for something like that, yes. Specifically I am looking for a function like mapWithFeedback/mapAccum, but for values in a Record<T, U>.

from remeda.

cjquines avatar cjquines commented on June 2, 2024

can you give an example of what that'd look like? i'm not sure what you mean here; mapAccum doesn't do that either

from remeda.

ludwignagelhus avatar ludwignagelhus commented on June 2, 2024

In Haskell I think there is a implementation for this, but not 100% sure.

const result = mapAccumObj({a: 1, b: 2, c: 4 }, (acc, n) => acc + inc(n), 0); // { a: 2, b: 5, c: 10 }

Similar to mapValues, but for mapAccum.

from remeda.

cjquines avatar cjquines commented on June 2, 2024

i'm not sure i see the use of this... entries in an object don't have an order they appear in. (technically, the order they're enumerated is consistent, but i don't think that records should be treated as having an order; in that case you want an array)

from remeda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.