findItem

Creates a find item transformation action.

const Action = v.findItem<TInput>(operation);

Generics

Parameters

Explanation

With findItem you can extract the first item of an array that matches the given operation.

Returns

Examples

The following examples show how findItem can be used.

Find duplicate item

Schema to find the first duplicate item in an array.

const DuplicateItemSchema = v.pipe(
  v.array(v.string()),
  v.findItem((item, index, array) => array.indexOf(item) !== index)
);

The following APIs can be combined with findItem.

Schemas

Methods

Utils

Contributors

Thanks to all the contributors who helped make this page better!

  • GitHub profile picture of fabian-hiller

Partners

Thanks to our partners who support the project ideally and financially.

Sponsors

Thanks to our GitHub sponsors who support the project financially.

  • GitHub profile picture of antfu
  • GitHub profile picture of Thanaen
  • GitHub profile picture of osdiab
  • GitHub profile picture of ruiaraujo012
  • GitHub profile picture of hyunbinseo
  • GitHub profile picture of F0rce
  • GitHub profile picture of Unique-Pixels
  • GitHub profile picture of jdgamble555
  • GitHub profile picture of nickytonline
  • GitHub profile picture of KubaJastrz
  • GitHub profile picture of caegdeveloper
  • GitHub profile picture of dslatkin