safe method returning "Just undefined"
See original GitHub issueI’m just testing the library to see if it’s going to be useful to me. But I’ve came up with this output and I’m not sure if is correct. My guess is that the console.log from the code bellow supposed to be Nothing
but is printing out Just undefined
is that correct? how come?
import { safe, isNil } from 'crocks'
import { inc } from './utils'
const exercise3 = () => {
const qs = { pageSize: 10, totalPages: 203 }
const page = safe(isNil, qs.page)
console.log(page) //Just undefined
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Is it better to return `undefined` or `null` from a javascript ...
If the answer is yes then use null else use undefined . More generally any function returning an object should return null when...
Read more >7 Tips to Handle undefined in JavaScript - Dmitri Pavlutin
The short answer is that JavaScript interpreter returns undefined when accessing a variable or object property that is not yet initialized.
Read more >Fun JavaScript: Safely dealing with undefined/null values ...
1- map: It takes a function, and if the value exists, applies that function on the value and returns a new value inside...
Read more >Handling null and undefined in JavaScript - Medium
In your own functions, you can avoid creating null or undefined ... If a function may not return with a value, it might...
Read more >Async function returning undefined : r/learnjavascript - Reddit
Async function returning undefined. Hello, I'm fairly new to JS and I'm trying to implement a RESTful API for some work.
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
Well the
not
function takes a predicate function, not a value, so that compose would not have worked as expected. all of the logic functions take either a predicatea -> Boolean
or aPred
datatype. You can consider them logic combinators in a way.I am an elm enthusiastic and this repo is really similar. So I really liked what I’ve seen so far.