随笔分类 -  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 阅读全文
posted @ 2021-03-10 19:47 Zhentiw 阅读(75) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2021-03-10 19:35 Zhentiw 阅读(104) 评论(0) 推荐(0) 编辑
摘要:import { SET_STATUS, FETCH_FULFILLED, FETCH_FAILED, RESET, } from '../actions/beerActions' import lensProp from 'ramda/es/lensProp' import set from 'r 阅读全文
posted @ 2020-04-30 02:00 Zhentiw 阅读(142) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-04-18 19:53 Zhentiw 阅读(153) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-02-24 20:12 Zhentiw 阅读(704) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-01-18 21:04 Zhentiw 阅读(418) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-01-07 19:22 Zhentiw 阅读(267) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-12-28 03:21 Zhentiw 阅读(218) 评论(0) 推荐(0) 编辑
摘要:We can compose lenses to get value: 阅读全文
posted @ 2017-04-25 20:56 Zhentiw 阅读(130) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-18 03:25 Zhentiw 阅读(274) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-13 18:39 Zhentiw 阅读(306) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-10 17:13 Zhentiw 阅读(232) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-10 03:32 Zhentiw 阅读(470) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-07 16:24 Zhentiw 阅读(195) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-06 16:51 Zhentiw 阅读(740) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-03 18:46 Zhentiw 阅读(308) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-03 17:08 Zhentiw 阅读(410) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-02 19:34 Zhentiw 阅读(302) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-02 19:15 Zhentiw 阅读(223) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-03-01 22:02 Zhentiw 阅读(346) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示