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

Fix type checking for null #499

Merged
merged 2 commits into from
Dec 20, 2017
Merged

Conversation

sophypal
Copy link
Contributor

This project uses semver, please check the scope of this pr:

  • #none# - documentation fixes and/or test additions
  • #patch# - backwards-compatible bug fix
  • #minor# - adding functionality in a backwards-compatible manner
  • #major# - incompatible API change

CHANGELOG

  • Fixed an issue when parsing json with null that was caused by incorrectly type checking for null.

addon/utils.js Outdated
const valueTypes = ['boolean', 'number', 'string']
const emptyTypes = [undefined, null]

if (emptyTypes.includes(val) || valueTypes.includes(typeof val)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be cleaner/faster to say:

if (typeof val !== 'object' || val === null) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k, like that better.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d6e1510 on sophypal:fix-null-json into ** on ciena-frost:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d6e1510 on sophypal:fix-null-json into ** on ciena-frost:master**.

@sophypal
Copy link
Contributor Author

sophypal commented Dec 20, 2017

👍

Approved with PullApprove

@sophypal sophypal merged commit 3a46731 into ciena-frost:master Dec 20, 2017
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.

3 participants