Skip to content

Why are returned values in arrayHave wrapped in '{ }' just because they are NaN #15

@brianemoore57

Description

@brianemoore57

I am using this with sequelize and the 'in' with strings, i.e. a name in an array of strings. The 'in' operator works fine with strings directly in sequelize. Processing with sqs, I have to strip the
curly braces that are added by this line in the sqs code, then it works fine.
| |
const arrayHave = (v) => { return v.split(' ').map(v => { return isNaN(v) ? {${v}} : v }) }

I assume the only use cases is that v is numeric or a string, so leaving it as a string here makes sense to me. Am I missing something? I have developed a method for querying on associations that works pretty well with this.
ps. It could be confusion with other string function versions of 'in', and that the curly braces would not affect a match. This usage will test whether that string matches any in the array exactly. So the curly braces do prevent a match.

Metadata

Metadata

Assignees

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