Skip to content

Keys with null values are always omitted #10

@vellotis

Description

@vellotis

Hey

I am using this module to whitelist keys that can be exposed by API. IMHO the filter should not omit key-value pairs that have null as value. As the current behavior is in place it cannot be changed. But maybe we could make a third parameter for the filter method where you could switch on/off null values omitting?
My suggestion would be to have a general property for allowing all null values. And possibility to switch separately for every type.

var result = filter(schema, document, {
  allowNulls: true
  // or
  allowNulls: ['boolean', 'number', 'integer', 'object', 'array', 'string', 'other']
})

Would it be considerable? PR?

BR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions