Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support NaN undefined Infinity in console.log output #65

Closed
wants to merge 2 commits into from
Closed

Support NaN undefined Infinity in console.log output #65

wants to merge 2 commits into from

Conversation

briancodes
Copy link

@briancodes briancodes commented Feb 17, 2019

Currently the console.log in the Ramda Repl displays undefined as null in arrays, and doesn't display object properties that have a value of undefined. The global properties NaN and Infinity are also displayed as null in arrays and objects.

This has caught me out a few times - so I thought I'd have a go at putting in a fix! Will close #49

Example of problem from the Repl

console.log(
  [null, undefined, NaN, Infinity, -Infinity], 
  { a: null, b:undefined, c:NaN, d:Infinity, e:-Infinity}
)  
[null,null,null,null,null]
{"a":null,"c":null,"d":null,"e":null}

I added a replacer function to the JSON.stringify method of logger.js - which covers common properties that JSON.stringify doesn't support. Updated the tests, and all passing (although two unrelated tests intermittently fail - this this is being addressed in PR #57 I think)

image

Replaces the following with non-quoted primitives:
- undefined, NaN, Infinity, -Infinity
@briancodes briancodes changed the title Support NaN Undefined Infinity in console.log output Support NaN undefined Infinity in console.log output Feb 17, 2019
@CrossEye
Copy link
Member

🌿

LGTM. Anyone else, @ramda/ramda-docs? @ramda/core?

@briancodes briancodes closed this Dec 30, 2019
@briancodes briancodes deleted the briancodes/logger-stringify-replacer branch December 30, 2019 00:43
@CrossEye
Copy link
Member

@briancodes: I'm sorry this one was allowed to languish. There hasn't been a lot of work on Ramda lately. I will try to rectify this over the next few months, and although GitHub won't let me reopen this because the repo was deleted, I will try to look at the commits soon. I think this makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected behaviour when logging out 'undefined'
2 participants