Skip to content

Error "any must be an array" even if an array is passed #124

Closed

Description

@thegeorgeous

The condition in this line evaluates to false under certain conditions even if Array.isArray(someArray) evaluates to true and Object.prototype.toString.call(someArray) returns [Object Array].

Could these edge cases be the problem?

I'm using supertest and nock to test a Cloudflare worker.

Using Array.isArray() instead of instanceof doesn't seem to be causing any problems for tests. https://github.com/thegeorgeous/json-rules-engine/commit/c2da34fc59d94cc4f8e6f54eaca431b079220f12

Happy to provide any more details if necessary.

UPDATE:
The issue seems to be a jest issue. Would you consider using Array.isArray() instead?

Activity

  1. CacheControl commented on Apr 26, 2019

    @CacheControl
    Owner

    @thegeorgeous looks like Array.isArray is faster anyway. if you submit a PR I'll happily merge it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions