随笔分类 - Ramda
摘要:In this lesson we'll see how to use the without function to remove items in a known list from an array. Then we'll generate our exclusion list and app
阅读全文
摘要:import { min, max, reduce} from 'ramda' cosnt numbers = [1,2,3,4,5,6,7,8] const lowest = reduce(min, Number.MAX_VALUE, numbers) // 1 const highest = r
阅读全文
摘要:import { SET_STATUS, FETCH_FULFILLED, FETCH_FAILED, RESET, } from '../actions/beerActions' import lensProp from 'ramda/es/lensProp' import set from 'r
阅读全文
摘要:For example, in React application, we have initial state; We have a toggle button, which everytime, it is toggle 'ui.filterGroups.status' to true/fals
阅读全文
摘要:In this post, we are going to see how to use Ramda Lens. For example, we have data: R.lens: R.lens takes a getter and a setter: R.lensProp: There is a
阅读全文
摘要:Javascript's Object.assign is shadow merge, loadsh's _.merge is deep merge, but has probem for array. We can use Ramda.js to easy solve the problem: T
阅读全文
摘要:When developing a Finite State Machine, it is often necessary to apply multiple transitions in tandem. To accomplish this in most Redux work flows req
阅读全文
摘要:If you hard-code a stream of props to target a specific prop, it becomes impossible to reuse that stream with any other components. Configuring your p
阅读全文
摘要:We can compose lenses to get value:
阅读全文
摘要:In this lesson we'll see how Ramda's path and pathOr functions can be used to safely access a deeply nested property from an object while avoiding the
阅读全文
摘要:In this lesson, we'll use Promise.all to get an array that contains the resolved values from multiple promises. Then we'll see how we can use Ramda to
阅读全文
摘要:In this lesson, we'll use Ramda's toPairs function, along with map, join, concatand compose to create a reusable function that will convert an object
阅读全文
摘要:In this lesson, we'll filter a list of objects based on multiple conditions and we'll use Ramda's allPass function to create a joint predicate from mu
阅读全文
摘要:In this lesson, we'll look at how we can use Ramda's invoker and constructNfunctions to take methods of an object and turn them into reusable utility
阅读全文
摘要:The difference between sort, sortBy, sortWith is that: 1. sort: take function as args. 2. sortBy: take prop as args. 3. sortWith: take array of funcs
阅读全文
摘要:In this lesson we'll take an array of objects and map it to a new array where each object is a subset of the original. We'll look at multiple ways to
阅读全文
摘要:Promise chains can be a powerful way to handle a series of transformations to the results of an async call. In some cases, additional promises are req
阅读全文
摘要:So what is Point-free function. Take a look this example: To make it as point-free function, we need to get rid of person object we pass into the func
阅读全文
摘要:Naming things is hard and arguments in generic utility functions are no exception. Making functions "tacit" or "point free" removes the need for the e
阅读全文
摘要:In this lesson we'll learn the basics of using lenses in Ramda and see how they enable you to focus changes on specific properties of an object while
阅读全文