If, after a preliminary examination, a defendant is held to answer, the magistrate before whom the examination was held may require any material witness examined on the part of the state:
1. To enter into a written undertaking, without surety, to the effect that such witness will appear and testify at the court to which the complaint and depositions, if any, are to be sent, or that the witness will forfeit such sum as the magistrate may fix and determine; or2. To enter into a written undertaking for the witness's appearance with such sureties and in such sum as the magistrate may deem proper, if the magistrate is satisfied, by proof on oath, that there is reason to believe that such witness will not appear and testify unless security is required.If any such material witness is a minor, any adult person may be allowed to give an undertaking for the minor's appearance, or the magistrate may take the undertaking of such minor in a sum not exceeding fifty dollars, which shall be valid and binding in law, notwithstanding the disability of minority.