0.12.1 • Published 2 years ago

url-sub v0.12.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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.
0.12.0

2 years ago

0.12.1

2 years ago

0.10.0

2 years ago

0.11.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago