随笔分类 - Javascript
摘要:We examine the of function we've seen on a few types and discover it's the Pointed interface. Instead of doing constructor way of Task: We can just sa
阅读全文
摘要:We learn the formal definition of a functor and look at the laws they obey. Any Functor should follow two rules: 1. Function composition: Map twice eq
阅读全文
摘要:We refactor a standard node callback style workflow into a composed task-based workflow. For example we have the code as following: We want to wrap as
阅读全文
摘要:We examine the data structure Task, see some constructors, familiar methods, and finally how it captures side effects through laziness. We using a 'da
阅读全文
摘要:If change the data a litte bit: Because the view: null, then it will skip .map(sum).
阅读全文
摘要:Learn how to use Object.assign to combine multiple objects together. This pattern is helpful when writing libraries that have a set of default options
阅读全文
摘要:Let's we want to combine two account accidently have the same name. So, here we can use Semi-group to combine them, because the semi-group have the kn
阅读全文
摘要:An introduction to concatting items via the formal Semi-group interface. Semi-groups are simply a type with a concat method that are associative. We d
阅读全文
摘要:For if..else:
阅读全文
摘要:We define the Either type and see how it works. Then try it out to enforce a null check and branch our code. Now, we try to make Box more useful. We w
阅读全文
摘要:After understanding how Box is, then we are going to see how to use Box to refacotr code, to un-nested expression. For example, we have code: So how i
阅读全文
摘要:Mapping abstract values to visual representations is what data visualization is all about, and that’s exactly what D3 scales do. Turning a test score
阅读全文
摘要:A part of Natural Language Processing (NLP) is processing text by “tokenizing” language strings. This means we can break up a string of text into part
阅读全文
摘要:The every method returns true or false based on whether or not every item in the array passes the condition you provide in a callback function. In thi
阅读全文
摘要:The key to being productive with Immutable JS is understanding how to update values that are nested. Using setIn you can place a new value directly in
阅读全文
摘要:Yarn is a new JavaScript package manager that aims to be speedy, deterministic, and secure. See how easy it is to drop yarn in where you were using np
阅读全文
摘要:Property access in Javascript can be problematic - especially when dealing with nested Objects and Arrays. Doing it manually and in a safe manner requ
阅读全文
摘要:Source You can also start a chain of then() method calls via Promise.resolve() and execute the synchronous code inside a callback: An alternative is t
阅读全文
摘要:Learn how to add, remove and test for CSS classes using the classList API. It's more powerful than using className and doesn't require any dependencie
阅读全文
摘要:Monads allow you to nest computations. They are a pointed functor that adds mjoin and chain functions to combine other functors. Brian shows a number
阅读全文

浙公网安备 33010602011771号