随笔分类 -  Ramda

摘要:Sometimes you just need a subset of an object. In this lesson, we'll cover how you can accomplish this using Ramda's pick and omit functions, as well 阅读全文
posted @ 2017-02-28 21:29 Zhentiw 阅读(456) 评论(0) 推荐(0) 编辑
摘要:In this lesson, we'll grab arrays of values from other arrays, resulting in a nested array. From there, we'll look at multiple ways to flatten the arr 阅读全文
posted @ 2017-02-28 20:13 Zhentiw 阅读(413) 评论(0) 推荐(0) 编辑
摘要:In this lesson we'll look at how you can use Ramda's unfold function to generate a list of values based on an initial seed. const R = require('ramda') 阅读全文
posted @ 2017-02-28 17:18 Zhentiw 阅读(281) 评论(0) 推荐(0) 编辑
摘要:From: To: Example2: 阅读全文
posted @ 2017-02-27 00:32 Zhentiw 阅读(494) 评论(0) 推荐(0) 编辑
摘要:Handling your logic with composable functions makes your code declarative, leading to code that's easy to read and easy to test. Breaking that up to w 阅读全文
posted @ 2017-02-17 18:50 Zhentiw 阅读(428) 评论(0) 推荐(0) 编辑
摘要:In this lesson we'll take some existing code and refactor it using some functions from the Ramda library, most notably, compose and converge. When we' 阅读全文
posted @ 2017-02-15 17:42 Zhentiw 阅读(342) 评论(0) 推荐(0) 编辑
摘要:When doing comparisons inside of functions, you end of relying heavily on the argument passed into the function. Ramda's converge allows you to do com 阅读全文
posted @ 2017-02-11 17:08 Zhentiw 阅读(289) 评论(0) 推荐(0) 编辑
摘要:You can really unlock the power of ramda (and functional programming in general) when you combine functions. Counting words in a string may seem like 阅读全文
posted @ 2017-02-08 16:10 Zhentiw 阅读(324) 评论(0) 推荐(0) 编辑
摘要:In this lesson we'll use a handful of Ramda's utility functions to take a queryString full of name/value pairs and covert it into a JavaScript object 阅读全文
posted @ 2017-01-20 16:50 Zhentiw 阅读(209) 评论(0) 推荐(0) 编辑
摘要:We don't always control the data we need in our applications, and that means we often find ourselves massaging and transforming our data. In this less 阅读全文
posted @ 2017-01-19 16:36 Zhentiw 阅读(194) 评论(0) 推荐(0) 编辑
摘要:Most of the functions offered by the ramda library are curried by default. Functions you've created or that you've pulled in from another library may 阅读全文
posted @ 2017-01-18 02:27 Zhentiw 阅读(303) 评论(0) 推荐(0) 编辑
摘要:const curry = R.curry((fns, ary) => R.ap(fns, ary)); const applyMultiAndAdd = curry([R.multiply(2), R.add(3)]); const res = applyMultiAndAdd([1,2,3]); console.log(res); //[2, 4, 6, 4, 5, 6] const... 阅读全文
posted @ 2016-12-21 20:48 Zhentiw 阅读(282) 评论(0) 推荐(0) 编辑
摘要:const needs = ['wifi', 'shower', 'laundry']; const homes = [{ name: 'Home 1', wifi: 'y', shower: 'y', laundry: 'y', metro: 'n', balcony: 'y', fireplace: 'n', pool: 'y' }, { name: '... 阅读全文
posted @ 2016-11-30 06:07 Zhentiw 阅读(509) 评论(0) 推荐(0) 编辑
摘要:When you want to build your logic with small, composable functions you need a functional way to handle conditional logic. You could wrap ternary expre 阅读全文
posted @ 2016-11-25 20:43 Zhentiw 阅读(517) 评论(0) 推荐(0) 编辑
摘要:Getter on Object: 1. prop: 2. props: Setter ob Object: Another way to use Lens: 阅读全文
posted @ 2016-10-10 21:12 Zhentiw 阅读(409) 评论(0) 推荐(0) 编辑
摘要:Sometimes you need to filter an array of objects or perform other conditional logic based on a combination of factors. Ramda's where function gives yo 阅读全文
posted @ 2016-10-10 00:53 Zhentiw 阅读(259) 评论(0) 推荐(0) 编辑
摘要:Pluck: Get one prop from the object array: Props: 阅读全文
posted @ 2016-10-10 00:48 Zhentiw 阅读(383) 评论(0) 推荐(0) 编辑
摘要:Take a function as arguement, and the function only return true of false. If the function 'f' return ture, when complement(f) will return false. var i 阅读全文
posted @ 2016-10-10 00:44 Zhentiw 阅读(288) 评论(0) 推荐(0) 编辑
摘要:We'll learn how to get a subset of an array by specifying items to include with filter, or items to exclude using reject. We'll also look at how to ge 阅读全文
posted @ 2016-09-24 02:57 Zhentiw 阅读(425) 评论(0) 推荐(0) 编辑

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