Comments (4)
I'm using this as a workaround, but it would be nice if there was an exposed function for something like this
if (uri.query().indexOf(key + "=") != -1) {
uri.removeQuery(key);
}
uri.addQuery(key, value);
from uri.js.
you could always use the wuery map:
var data = uri.query(true);
data.foo = "baz";
uri.query(data);
I see how that is inconvenient, though… without having the matter thought through, accepting a callback function would be nice:
uri.query(function(data) {
data.foo = "bar";
});
from uri.js.
I overlooked the uri.query(true)
API, which is much cleaner than my indexOf/removeQuery way. It would be nice if there was a 1 line call to set/update instead of just set/append. Not sure if any of these are better APIs
addQuery("foo", "bar", true)
addQuery({foo, "bar"}, true)
setQuery("foo", "bar")
The callback would be nice to have as well, although I think a compliment to addQuery/removeQuery would be best.
from uri.js.
Thanks
from uri.js.
Related Issues (20)
- Different results between 1.19.1 and 1.19.2 when using uri.scheme HOT 4
- What is the point of directory, suffix, etc? HOT 2
- Support for handling search as ES6 Map instead of Object properties
- setSearch() breaks previous url parameters
- Property for File Name without File Extension
- A reference resolution does not match RFC3986
- Test if URI/URL is templated
- URI.min.js 1.19.4 throws "does not have either property: href, src, action, cite" HOT 2
- [Feature request] Support for nested objects inside template builder.
- Hope to join the 'filenameNoExtension' api
- directory function is prepending not appending
- Append segments
- Trying to get in touch with you regarding a security issue HOT 1
- Handling of relative URLs that have a protocol in latest 1.19.7 HOT 1
- @types/urijs/index can only be default-imported using the 'allowSyntheticDefaultImports' flag HOT 1
- charset=Shift_JIS will fail to parse URI.js with a syntax error caused by non-ASCII characters in RegExp HOT 2
- Make invalid port check optional to support url templates
- Can we change separator?
- URI malformed exception is thrown when overriding path/pathname HOT 1
- Please do not omit the file extension for the value of the "main" field in the package.json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uri.js.