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

linksmith

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linksmith - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

22

dist/index.js

@@ -32,2 +32,20 @@ "use strict";

if (options != undefined) {
const www = "www.";
let hasWww = false;
let protocol = "";
const protocolArr = ["http://", "https://"];
// Store protocol
protocolArr.forEach(item => {
if (mainUrl.startsWith(item)) {
const regex = new RegExp(`^${item}`);
mainUrl.replace(regex, "");
protocol = item;
}
});
// Handling www
if (mainUrl.startsWith(www)) {
const regex = new RegExp(www);
mainUrl.replace(regex, "");
hasWww = true;
}
// Delete slash from mainUrl

@@ -50,4 +68,6 @@ mainUrl = mainUrl.endsWith('/') ? mainUrl.replace(/\/$/, "") : mainUrl;

}
// March all elements
const combinedUrl = hasWww ? protocol + www + mainUrl : protocol + mainUrl;
// Create a new URL object from the modified mainUrl.
const url = new URL(mainUrl);
const url = new URL(combinedUrl);
// If queryParams are provided, append them to the URL.

@@ -54,0 +74,0 @@ if (options.queryParams != undefined) {

2

package.json
{
"name": "linksmith",
"version": "1.1.1",
"version": "1.2.0",
"description": "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.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

![License](https://img.shields.io/badge/License-MIT-blue)
![Version](https://img.shields.io/badge/Version-1.1.0-orange)
![Version](https://img.shields.io/badge/Version-1.2.0-orange)

@@ -23,2 +23,3 @@ # linksmith

- **Query Parameters**: Effortlessly add query parameters.
- **Port Management**: Add port of your URL.

@@ -25,0 +26,0 @@ ## Installation

@@ -36,6 +36,26 @@ /**

// Check if options are provided and proceed with modifying the URL.
if (options != undefined) {
const www = "www."
let hasWww = false
let protocol = ""
const protocolArr = ["http://", "https://"]
// Store protocol
protocolArr.forEach(item => {
if (mainUrl.startsWith(item)) {
const regex = new RegExp(`^${item}`)
mainUrl.replace(regex, "")
protocol = item
}
})
// Handling www
if (mainUrl.startsWith(www)) {
const regex = new RegExp(www)
mainUrl.replace(regex, "")
hasWww = true
}
// Delete slash from mainUrl

@@ -65,4 +85,7 @@ mainUrl = mainUrl.endsWith('/') ? mainUrl.replace(/\/$/, "") : mainUrl

// March all elements
const combinedUrl = hasWww ? protocol + www + mainUrl : protocol + mainUrl
// Create a new URL object from the modified mainUrl.
const url = new URL(mainUrl);
const url = new URL(combinedUrl);

@@ -69,0 +92,0 @@ // If queryParams are provided, append them to the URL.

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