protected function sanitize(FieldTypeInterface $field)
    {
        return function ($value, $key, $type) use ($field) {
            $validator = $this->validator->make(
                [$key => $value],
                $this->getTermRules(),
                $this->getTermMessages(),
                $this->getTermPlaceholders()
            );

            $validation = $validator->valid();

            return $validation[$key] ?? null;
        };
    }