🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

url-sub

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

url-sub

Format URLs using templates.

0.12.1
latest
Source
npm
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

URL Sub 🔗↔️

Format URLs for fetch requests using templates and substitution values.

usage

import * as UrlSub from "url-sub"

UrlSub.formatUrl("https://api.example.com", "/user/:username/bio", {
  username: "jake",
  exclude_sensitive: true
})

// https://api.example.com/user/jake/bio?exclude_sensitive=true

// If you'd like to use options.
UrlSub.formatUrlWithOptions(
  "https://api.example.com/",
  "/user",
  {
    normally_encoded: "https://dont-encode-me.com",
  },
  { encode: false }
),

// "https://api.example.com/user?normally_encoded=https://dont-encode-me.com"

options

  • encodeParams: boolean - don't encode query params.

Keywords

url

FAQs

Package last updated on 19 Aug 2022

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