define("bsvariant",['jquery'],function($){

    let setvariant = function(el, add,removePtrn)
    {
        console.info('element:', el);
        if(!Array.isArray(add)){
            add = [add];
        } 
        if(!Array.isArray(removePtrn)){
            removePtrn = [removePtrn];
        } 
        // remove any style classes
        for(let c of removePtrn) {
            el.classList.remove.apply(el.classList, Array.from(el.classList).filter(v=>v.startsWith(c)));
        }

        for(let c of add) {
            el.classList.add(c);
        }

    };

    let my = {
        field: function(el, variant)
        {
            setvariant(el,['border-'+variant, 'text-'+variant],['border-','text-']);
        },
        border: function(el, variant)
        {
            setvariant(el,['border-'+variant,],['border-',]);
        },
        text: function(el, variant)
        {
            setvariant(el,['text-'+variant],['text-']);
        },
        button: function(el, variant)
        {
            setvariant(el,['btn-'+variant],['btn-']);
        },
        custom: function(el, add,removePtrn)
        {
            setvariant(el,add,removePtrn);
        }
    };
    return my;

});