Code Monkey home page Code Monkey logo

Comments (24)

char0n avatar char0n commented on May 10, 2024 1

Yep, the plan is to implement it. Checkout out the first comment of this issue. It is the first function to be implemented for this issue ;]

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

resolveP = bind(Promise.resolve, Promise);

from ramda-adjunct.

rockymadden avatar rockymadden commented on May 10, 2024

Something like https://github.com/kirillrogovoy/promised-pipe might also be useful.

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

@rockymadden isn't pipeP what you're looking for ?

from ramda-adjunct.

rockymadden avatar rockymadden commented on May 10, 2024

If all functions are return promises, yes. The promised-pipe brings the ability to intermix, at any point, sync and async functions.

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

pipeP does the same. The only requirement is that first function in the pipe must be promise generator (returns promise).

const { add, subtract }  = require('ramda');

const resolveP = Promise.resolve.bind(Promise);
const asyncAdd = val => resolveP(val).then(add(1));

pipeP(
  resolveP,
  add(1),
  subtract(1),
  asyncAdd,
  add(2),
  subtract(1)
)(1);

from ramda-adjunct.

rockymadden avatar rockymadden commented on May 10, 2024

Nice, hmm yeah ignore me then. Thanks! BTW, I see some of what you are laying out here mentioned through out various Ramda issues on the topic of Promises (e.g. ramda/ramda#1869 (comment)). Lovely idea.

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

NP

from ramda-adjunct.

rockymadden avatar rockymadden commented on May 10, 2024

Thoughts on your resolveP function (or R.bind(Promise.resolve, Promise)) being made into a standard function in adjunct (e.g. resolveP or ofP)? Seems to be generally usable to kick things off as a Promise.

EDIT: Ignore, I see it now as the first function in the list above.

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

You can provide a pull request for it if you wish and become a contributor. ramda-adjunct ecosystem is ready to receive PR's and I always welcome any help. What do you think ?

from ramda-adjunct.

rockymadden avatar rockymadden commented on May 10, 2024

Yep, love it. I've had a subset of this library internally for a while. Was reading through the Ramda wiki and saw ramda-adjunct, which was exactly what I myself was doing.

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

Yep, I guess everybody is doing it. This library has a potential saving a lot of development time to a lot of people. Check this article to find out more.

Great, check out the CONTRIBUTING.md and you can start right away.

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

Further inspirations: https://github.com/krainboltgreene/unction.js?files=1

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

https://stackoverflow.com/questions/27746304/how-do-i-tell-if-an-object-is-a-promise

from ramda-adjunct.

Undistraction avatar Undistraction commented on May 10, 2024

@char0n You OK if I bump this to 2.7.0?

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

Bump it up or remove the milestone entirely. Have no usecases for the rest of them right now.

from ramda-adjunct.

Undistraction avatar Undistraction commented on May 10, 2024

@char0n When you get a chance maybe move remaining to separate issues.

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

Yeah me or anybody else can do that.

Note for me and others: when doing it reference this issue in the child issues just for reference and then close this one.

from ramda-adjunct.

guillaumearm avatar guillaumearm commented on May 10, 2024

since #676, additional candidates are :

  • mapP
  • filterP
  • rejectP

IMO, we need to talk about parallel and series behavior, isn't ?

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

Yes I think we should and I'm very interested in this discussion. But I'm still thinking about this in a context of already implemented reduceP. Does it make sense to have reduceP work in a parallel mode ?

Can you provide example of mapP being parallel and serial ?

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

Created separate issue for raceP

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

created separate issue for catchP

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

created separate issue for thenCatchP

from ramda-adjunct.

char0n avatar char0n commented on May 10, 2024

Not going to implement tapP for now.

from ramda-adjunct.

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.