question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

safe method returning "Just undefined"

See original GitHub issue

I’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:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
evilsoftcommented, Sep 13, 2018

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 predicate a -> Boolean or a Pred datatype. You can consider them logic combinators in a way.

1reaction
wellyalcommented, Sep 13, 2018

Hope we pass your tests, if we do not, please let us know how we didn’t and we may be able to accommodate or explain why.

I am an elm enthusiastic and this repo is really similar. So I really liked what I’ve seen so far.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found