Git Product home page Git Product logo

Comments (8)

nextmat avatar nextmat commented on June 8, 2024

My patch in #56 resolves the first issue (every key no longer needs a value). While replacing the existing entry is not always what you want, it is a more common use case, so I would propose:

  • query-set continues to replace if the specified name already exists
  • query-add always adds a new element

This is much more consistent with the common meanings of 'set' and 'add' in most programatic environments. As an aside, with the internal refactoring of query string management included in the patch, implementing query-add is pretty trivial.

What is the difference between query-unset NAME and query-remove NAME?

from htty.

njonsson avatar njonsson commented on June 8, 2024

query-remove NAME removes the last value keyed by NAME, whereas query-unset NAME would remove all values keyed by NAME.

from htty.

nextmat avatar nextmat commented on June 8, 2024

Ah, makes sense. May I propose query-remove NAME [VALUE] where if value is not specified it does as you suggest, but if value is specified it removes that specific instance?

from htty.

njonsson avatar njonsson commented on June 8, 2024

Excellent idea. I’ll apply it to ‘cookie-remove’, too.

from htty.

nextmat avatar nextmat commented on June 8, 2024

The patch in #63 should close this issue.

from htty.

njonsson avatar njonsson commented on June 8, 2024

query-add, query-remove, and query-set are all working as desired now.

I like the enhancement you made to the concept of query-remove that looks for matches by both name and value. It would be good if query-unset worked this way, too:

  • query-add NAME [VALUE [NAME [VALUE ...]]]
  • query-remove NAME [VALUE]
  • query-set NAME [VALUE [NAME [VALUE ...]]]
  • query-unset NAME [VALUE]
  • query-unset-all

from htty.

nextmat avatar nextmat commented on June 8, 2024

So something like query-unset foo would remove all instances of foo in the query string regardless of value and query-unset foo bar would only remove instances that were foo=bar ?

from htty.

njonsson avatar njonsson commented on June 8, 2024

That’s what I was thinking, yes.

from htty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.