edit-url
v1.0.1
Published
Edit URL in a callback function
Downloads
107
Maintainers
Readme
Features
- Fully tested
- Asynchronous manipulations
- ES6
Installation
$ npm install --save edit-url
Usage
Import
const editURL = require('edit-url');
Sync
editURL('http://google.com/', (obj) => obj.query.q = "Node.JS"); // http://google.com/?q=Node.JS
Async
editURL('http://localhost/', (obj, cb) => {
findAvailablePort((port)=> {
obj.port = port;
});
}), (edited) => {
console.info(edited); // http://localhost:14036/
});
Dependencies
It uses Node's url
module and has no external dependency.
Mocha is use for the tests