Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

linksmith

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linksmith

Linksmith is a flexible and powerful TypeScript-based URL builder for Node.js and frontend projects. Designed for developers who need to construct clean and efficient URLs, linksmith allows seamless addition of subdomains, paths, and query parameters with

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
300
Maintainers
0
Weekly downloads
 
Created
Source

License Version

linksmith

Linksmith is a flexible and powerful TypeScript-based URL builder for Node.js and frontend projects. Designed for developers who need to construct clean and efficient URLs, linksmith allows seamless addition of subdomains, paths, and query parameters with a simple, intuitive API. Linksmith handles edge cases like double slashes, missing query values, and dynamic subdomain additions, making it ideal for RESTful APIs, microservices, and other projects requiring dynamic URL generation. Linksmith is your all-in-one solution for URL construction in TypeScript.

  • linksmith

Key Features

  • TypeScript Support: Built with TypeScript, providing type safety and autocompletion.
  • Subdomain Management: Easily add or modify subdomains in your URL.
  • Path Handling: Concatenate paths with automatic slash normalization.
  • Query Parameters: Effortlessly add query parameters.

Installation

npm i linksmith

Usage

It's super easy! this function get mainURL and options and it returns URL as string.

Input table

NameTypeExplanation
mainUrlstring*Required
optionsobjectOptional

Options table

NameTypeExplanation
portstring or number-
subDomainsstring arraywithout any dot[.]
pathsstring arraywithout any slash[/]
queryParamsobject-

Example

import linksmith from 'linksmith'

...

const mainUrl = "https://example.com"
const options = {
    port: 3000,
    subDomains: ["api", "v1"],
    paths: ["users", "123"],
    queryParams: { filter: "active", sort: "name" }
}

const url = linksmith(mainUrl, options);

console.log(url);
// Output: "https://api.v1.example.com:3000/users/123?filter=active&sort=name"
 

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 13 Nov 2024

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc