Helper functions in Reader env

node v6.17.1
version: master
endpointsharetweet
const Reader = require('ramda-fantasy').Reader const R = require('ramda') // This helper method requires some configuration const helper = (x) => Reader(env => env.helperShouldReturnZero ? 0 : x) // This method makes use of the configured helper and also requires some configuration const method = (x) => Reader(env => env.helper(x) * x + env.y) // How do I put `helper` in `env` while having them share the same environment? method(12).run({ helperShouldReturnZero: false, y: 3 }) // Expected output: 147 method(12).run({ helperShouldReturnZero: true, y: 3 }) // Expected output: 3
Loading…

no comments

    sign in to comment