title: Inserting a Boolean function to validate with 'Yup' library
body: <p>I have this function that is working correctly and returns a Boolean value. I would like to insert this function to validate an input field from the 'Yup' library.</p>
  <p><strong>Here is the function:</strong>
  This the function. It is working succesfully.</p>
  <pre><code>  console.log(isHsCodeAllowed(111111)) //true
    console.log(isHsCodeAllowed(222222)) //false
  
    function isHsCodeAllowed(hsCode) {
      let status = ''
  
      const hsCodeList =
        [
          { &quot;number&quot;: 111111, &quot;status&quot;: &quot;allowed&quot; },
          { &quot;number&quot;: 222222, &quot;status&quot;: &quot;prohibited&quot; },
          { &quot;number&quot;: 333333, &quot;status&quot;: &quot;allowed&quot; },
          { &quot;number&quot;: 444444, &quot;status&quot;: &quot;prohibited&quot; }
        ]
  
      for (let i = 0; i &lt; hsCodeList.length; i++) {
        if (hsCode === hsCodeList[i][&quot;number&quot;]) {
          status = hsCodeList[i][&quot;status&quot;]
        }
      }
  
      return status === 'allowed' || false
    }
  </code></pre>
  <p><strong>Here is the place I would like to implement it in 'Yup':</strong>
  It does not work. It does not return the validation message.</p>
  <pre><code>async function validateProduct() {
      try {
        const schema = Yup.object().shape({     
          hsCode: Yup.number()
            .test(isHsCodeAllowed, 'This code is prohibited') // &lt;---------------    
        });
  }    
  </code></pre>
  <p>You can use any method that works or another solution. It is not mandatory to use the 'test' method, but it is mandatory to use the Yup library.</p>