Socket
Socket
Sign inDemoInstall

urlconcat

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    urlconcat

Concats paths in an url, places slashes where necessary.


Version published
Maintainers
1
Install size
5.18 kB
Created

Readme

Source

Build Status

urlconcat

Concats paths in an url, places slashes where necessary.

Installation

npm install urlconcat --save

Usage

Importing

All these methods work:

var urlconcat = require('urlconcat');
var concat = urlconcat.concat;
import urlconcat from 'urlconcat';
const concat = urlconcat.concat;
import { concat } from 'urlconcat';

Using

It will place slashes between url parts, but not before query parameters:

concat('http://localhost:8080/', 'api/search', 'something', '?a=b&b=c'); 
// 'http://localhost:8080/api/search/something?a=b&b=c'

It will remove double slashes:

concat('http://localhost:8080/', '/search')
// 'http://localhost:8080/search

It will leave trailing slashes:

concat('http://localhost:8080/', 'search/')
// 'http://localhost:8080/search/

Keywords

FAQs

Last updated on 05 Nov 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc