Skip to content
This repository was archived by the owner on Dec 19, 2022. It is now read-only.

fix arrays passing as objects#41

Open
ghost wants to merge 1 commit into
masterfrom
array-objects-bug
Open

fix arrays passing as objects#41
ghost wants to merge 1 commit into
masterfrom
array-objects-bug

Conversation

@ghost

@ghost ghost commented Apr 8, 2016

Copy link
Copy Markdown

s.object() currently accepts arrays. this change checks for arrays being passed in and rejects them...

i suspect this change could have a wide range of impact in the apis where it's used.. needs careful consideration

@TabDigital/ping-api

@mention-bot

Copy link
Copy Markdown

By analyzing the blame information on this pull request, we identified @rprieto, @nguyenchr and @kiddkai to be potential reviewers

@rprieto

rprieto commented Apr 8, 2016

Copy link
Copy Markdown
Contributor

Great catch!

I doubt anyone is using s.object() to match arrays, but technically arrays are objects... But then again null is an object too and we don't allow null :)

I'm quite happy to reject arrays, but maybe as a major bump? Other option, two-birds-on-stone, is to tackle #39 at the same time. Then we could have

// if someone wants to fall back to the previous behaviour
s.object({with: fields, allowArrays: true})

@mehdivk

mehdivk commented Sep 2, 2016

Copy link
Copy Markdown
Contributor

+1 for #39 and this PR to not allow arrays to be considered object!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants