So, we use a very nice ramda library at work, which is great, because we can mainly use the point - free code style. The problem is that there are far fewer places to search when something is wrong, which indicates something in our code; most runtime errors are due to improper use of the ramda's complex functions. Combine this with passing these functions to a framework that uses a lot of redirection (we are in reaction / reduction), and often when something goes wrong, it is deep in the library code, and it is very difficult to know where I went wrong.
Is there a way to mitigate this problem without leaving the dot style?
One option is to use R.tap, for example:
R.tap
const f = R.pipe( R.tap(console.log), // logs x g, R.tap(console.log), // logs g(x) h, R.tap(console.log), // logs h(g(x)) i, R.tap(console.log), // logs i(h(g(x))) j, R.tap(console.log) // logs j(i(h(g(x)))) ); f(x);
Another option is to use Sanctuary , which leads to informative exceptions when the function is applied to arguments of the wrong types.
I encountered the same problem with Ramda in my side projects. This is what made me abandon this in production, for now.
JavaScript . , . unit test , , .
: , Ramda-debug R.tap(), , , . , , , , , .
R.tap()
Source: https://habr.com/ru/post/1659099/More articles:Search with additional parameters - spring-data-jpaMultiple Content Thymeleaf Scheme - spring-bootWorking with a Long Click listener using android recyclers - androidПреобразование 3D-списка в массив 3D NumPy - pythonElement product of two two-dimensional lists - pythonGet the default value for an initialized element in a class - c ++Spark exception when converting MySQL table to parquet - apache-sparkhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1659102/how-can-i-prepend-characters-to-a-string-using-loops&usg=ALkJrhj5ZBGLW6YlT57lSOK1UW-HYsgtjgUse reselect selector with parameters - javascriptWhen do you use an insecure JWS header? - jwtAll Articles