🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

edit-url

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edit-url

Edit URL in a callback function

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Edit URL

Utility function that allows sync and async manipulations on URL strings.

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

Keywords

edit

FAQs

Package last updated on 20 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts