[ramda_v0.26.x] Cannot call `R.pipe`: string is not compatible with null or undefined
See original GitHub issueConsider this function:
const setLayout = (callback: (GridItem[]) => void) =>
R.pipe(
key => localStorage.getItem(key),
R.tryCatch(JSON.parse, R.F),
R.when(isLayoutValid, callback)
);
setLayout(someCallback)('someKey');
flow will throw an error:
Cannot call `R.pipe`: string is not compatible with null or undefined
JSON.parse
expects a string
as an input, but first function in the pipe may return either string
or undefined
.
Should R.tryCatch
suppress this sort of error popping up?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
TruncatePipe fails with undefined or null input value to truncate
When value to truncate is undefined or null, the TruncatePipe.transform() call throws a TypeError. This error points to line 12 of truncate.pipe.ts where ......
Read more >Is there a way to check for both `null` and `undefined`?
Using a juggling-check, you can test both null and undefined in one hit: if (x == null) {. If you use a strict-check,...
Read more >18 Pipes | R for Data Science
18.1 Introduction Pipes are a powerful tool for clearly expressing a sequence of multiple operations. So far, you've been using them without knowing...
Read more >Pipes in R Tutorial For Beginners | Discover %>% with magrittr
This tutorial will give you an introduction to pipes in R and will cover the following topics: Run and edit the code from...
Read more >Create Custom Pipe in Angular to Replace Null Value With a ...
Not a good user experience. We will solve that problem by creating our own custom pipe that will replace the null or undefined...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@retyui ugh - I was thinking
JSON.stringify
. I will sit in silent shame now. Thanks for chiming in!Any way I could wrap
R.tryCatch
into something that would prevent the error?