Skip to content

Question: null input #6

@ariutta

Description

@ariutta

What do you think of adding code to this library to check that the input is an object? Right now, the code below would throw an error:

var schema = {
    "title": "Example Schema",
    "type": "object",
    "properties": {
      "firstName": {
        "type": "string"
      }
  }
};
filter(schema, null);
filter(schema, 'mystring');

For my use case, I'm going to add code like the following before calling filter:

if (typeof input !== 'object') {
  return {}; // or maybe return null?
}

Want it in this library? Any extra checks will decrease performance, so maybe it belongs outside this library.

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