随笔分类 - Javascript
摘要: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
阅读全文
摘要:Functor laws: 1. Identity: 2. Composition: Natural Transformations: "Takes one functor to another without knowing anything about the value".
阅读全文
摘要:EventStream: You can use RxJS, BaconJS or any reactive programming lib you want: Here using BaconJS; we need to call onValue to subscribe stream. Futu
阅读全文
摘要:IO functor doesn't like Maybe(), Either() functors. Instead of get a value, it takes a function. API: Examples:
阅读全文
摘要:Jest comes pre-packaged with the ability to track code coverage for the modules you're testing, but it takes a little extra work to make it track unte
阅读全文
摘要:Either Functor: Examples:
阅读全文