changing bloodhoundjs minlength based on type

we have a typeahead search powered by bloodhoundjs. currently the minlength is set to 3. however I was wondering is it possible to change the minlength dynamically based on string vs number. so if the user types only numbers in the input the minlength value is 1 if it is a string then the minlength value would be 3.

here is a fiddle with it set to 3 for everything. again I would like it to dynamically change to 1 if the input is just numbers.

const $tagsInput = $('#tagsInput')
    hint: true,
    highlight: true,
    minLength: 3
}, {
    name: 'suggestions',
    displayKey: 'value',
    source: bloodhoundSuggestions

something like

minLength: (!isNaN(parseFloat(n)) && isFinite(n)) ? 1 : 3 


comments powered by Disqus