New array function "find"

Implement an equivalent of Array.find from JS in Fauna.

Proposed specs

  haystack: T[],
  check: (item: <T>, index: Number) => Boolean
): <T>

Returns the item<T> that satisfies check. Returns null when no item satisfied check.

Further readings: Array.prototype.find() - JavaScript | MDN

Good idea, although not exactly the signature, in the meantime you might be helped with Eigil’s library: GitHub - shiftx/faunadb-fql-lib

1 Like