Skip to content
This repository has been archived by the owner on Dec 21, 2020. It is now read-only.

Commit

Permalink
Add delete query param sample and test
Browse files Browse the repository at this point in the history
  • Loading branch information
徐培堯 committed Nov 21, 2017
1 parent 69e2c30 commit 5830815
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ builder.fragment = 'hash';
// Log builder result, result: 'https://www.google.com/search?q=newKeyword#hash'
console.log(builder.toString());

// Delete Query Param
delete builder.query.q;

// Log builder result, result: 'https://www.google.com/search#hash'
console.log(builder.toString());

// Update input URI Query
const updatedURI = UriBuilder.updateQuery(testURI, {
q: 'test',
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"build": "gulp build",
"test": "npm run build && node dist/test.js"
},
"keywords": ["URI", "URL"],
"keywords": [
"URI",
"URL"
],
"homepage": "https://github.com/XuPeiYao/uriBuilder",
"repository": {
"type": "git",
Expand Down
10 changes: 10 additions & 0 deletions src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,13 @@ emptyBuilder.query.action = 'back';
console.assert(
emptyBuilder.toString() === 'http://guest@example/home/index?action=back#top'
);
emptyBuilder.toString();

hr();
console.info('Delete Query Param Test');

delete emptyBuilder.query.action;
console.assert(
emptyBuilder.toString() === 'http://guest@example/home/index#top'
);
console.log(emptyBuilder.toString());

0 comments on commit 5830815

Please sign in to comment.