diff --git a/README.md b/README.md index 6047835..bb5f9d3 100644 --- a/README.md +++ b/README.md @@ -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', diff --git a/package.json b/package.json index d141689..8fc6e45 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/test.ts b/src/test.ts index f444c92..955aee1 100644 --- a/src/test.ts +++ b/src/test.ts @@ -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());