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

conditions in bunsen-model not checking for null explicitly #77

Open
cbeekciena opened this issue Mar 1, 2017 · 0 comments
Open

conditions in bunsen-model not checking for null explicitly #77

cbeekciena opened this issue Mar 1, 2017 · 0 comments

Comments

@cbeekciena
Copy link

cbeekciena commented Mar 1, 2017

I noticed that if a bunsenValue for a property is null, then this conditional covers that case:

export function ifNotUndefined (path) {
  return [
    {
      if: [
        {
          [path]: {
            notEqual: undefined
          }
        }
      ]
    }
  ]

as opposed to checking for null explicitly:

export function ifNotUndefinedAndNotNull (path) {
  return [
    {
      if: [
        {
          [path]: {
            notEqual: undefined
          },  // AND
          [path]: {
            notEqual: null
          }
        }
      ]
    }
  ]
}

Using unless, also did not suffice:

export function ifNotUndefinedAndNotNull (path) {
  return [
    {
      unless: [
        {
          [path]: {equals: undefined}
        },  // OR
        {
          [path]: {equals: null}
        }
      ]
    }
  ]
}
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

No branches or pull requests

1 participant