stephenkr / nuxt-feature-toggle

The nuxt feature toggle module

Home Page:https://www.npmjs.com/package/nuxt-feature-toggle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider a grouped querystring mode?

israelroldan opened this issue · comments

Would you consider adding a grouped querystring parsing mode? This mode would allow to pass all toggles in a single query string param:

?toggles=my-unique-key:true,foo:bar

which will be parsed to be:

{
    my-unique-key: true,
    foo: 'bar'
}

This could be configured as part of the querystring option:

{
    featureToggle: {
        querystring: {        // defaults to "false"
            enabled: true,    // can also be expressed as `querystring: true` and all defaults apply
            mode: "grouped",  // defaults to "single"    
            prefix: "_t"      // defaults to "toggle", introduced in #27 as `querystringPrefix`
        }
    }
}

@stephenkr If you think this may be a good addition, I'm ready to submit a PR :)

Hi @israelroldan yes this looks great, it would be nice to provide this. Please feel free to submit the PR, I'd be happy to review and merge it.

Thank you for contributing.