mswjs / data

Data modeling and relation library for testing JavaScript applications.

Home Page:https://npm.im/@mswjs/data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can `findFirst()` support the `where` parameter as function?

cp3hnu opened this issue · comments

This API like that

model.findFirst({
  where: (item) => return true
});

It will be more flexible.

Hey, @cp3hnu. Thanks for proposing this!

If I remember the context correctly, the intention was to have all the queries serializable to string so that we could synchronize occurring operations between different tabs. That's still relevant for the current version of the library but may not be as relevant for the future releases.

The proposal itself makes sense. Let's keep it in mind, I shall revisit this when I'm working on this library again.