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

build-url-ts

Package Overview
Dependencies
Maintainers
1
Versions
305
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

build-url-ts - npm Package Compare versions

Comparing version 5.0.9 to 6.0.0

dist/build-url.d.ts

87

dist/build-url.js

@@ -1,87 +0,2 @@

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global['build-url'] = factory());
}(this, (function () { 'use strict';
function appendPath(path, builtUrl, lowerCase) {
if (builtUrl[builtUrl.length - 1] === "/") {
builtUrl = builtUrl.slice(0, -1);
}
var pathString = String(path).trim();
if (lowerCase) {
pathString = pathString.toLowerCase();
}
if (pathString.indexOf("/") === 0) {
builtUrl += pathString;
}
else {
builtUrl += "/" + pathString;
}
return builtUrl;
}
function buildHash(hash, lowerCase) {
var hashString = "#" + String(hash).trim();
return lowerCase ? hashString.toLowerCase() : hashString;
}
function buildQueryString(queryParams, lowerCase, disableCSV) {
var queryString = [];
var _loop_1 = function (key) {
if (Object.prototype.hasOwnProperty.call(queryParams, key) &&
queryParams[key] !== void 0) {
var param_1;
if (disableCSV &&
Array.isArray(queryParams[key]) &&
queryParams[key].length) {
queryParams[key].forEach(function (v) {
param_1 = v !== 0 ? v || "" : 0;
queryString.push(key + "=" + encodeURIComponent(String(param_1).trim()));
});
}
else {
if (lowerCase) {
param_1 = String(queryParams[key]).toLowerCase() || "";
}
else {
param_1 = queryParams[key] !== 0 ? queryParams[key] || "" : 0;
}
queryString.push(key + "=" + encodeURIComponent(String(param_1).trim()));
}
}
};
for (var key in queryParams) {
_loop_1(key);
}
return "?" + queryString.join("&");
}
function buildUrl(url, options) {
var builtUrl;
if (url === null) {
builtUrl = "";
}
else if (typeof url === "object") {
builtUrl = "";
options = url;
}
else {
builtUrl = url;
}
if (options === null || options === void 0 ? void 0 : options.path) {
builtUrl = appendPath(options.path, builtUrl, options.lowerCase);
}
if (options === null || options === void 0 ? void 0 : options.queryParams) {
builtUrl += buildQueryString(options.queryParams, options.lowerCase, options.disableCSV);
}
if (options === null || options === void 0 ? void 0 : options.hash) {
builtUrl += buildHash(options.hash, options.lowerCase);
}
return builtUrl;
}
return buildUrl;
})));
"use strict";function buildQueryString(r,n,a){var i=[];for(var e in r)!function(e){var t;Object.prototype.hasOwnProperty.call(r,e)&&void 0!==r[e]&&(a&&Array.isArray(r[e])&&r[e].length?r[e].forEach(function(r){t=0!==r?r||"":0,i.push(e+"="+encodeURIComponent(String(t).trim()))}):(t=n?String(r[e]).toLowerCase()||"":0!==r[e]?r[e]||"":0,i.push(e+"="+encodeURIComponent(String(t).trim()))))}(e);return"?"+i.join("&")}function appendPath(r,e,t){"/"===e[e.length-1]&&(e=e.slice(0,-1));var n=String(r).trim();return t&&(n=n.toLowerCase()),0===n.indexOf("/")?e+=n:e+="/"+n,e}function buildHash(r,e){var t="#"+String(r).trim();return e?t.toLowerCase():t}function buildUrl(r,e){var t;return null===r?t="":"object"==typeof r?(t="",e=r):t=r,null!=e&&e.path&&(t=appendPath(e.path,t,e.lowerCase)),null!=e&&e.queryParams&&(t+=buildQueryString(e.queryParams,e.lowerCase,e.disableCSV)),null!=e&&e.hash&&(t+=buildHash(e.hash,e.lowerCase)),t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.appendPath=appendPath,exports.buildHash=buildHash,exports.buildQueryString=buildQueryString,exports.default=buildUrl;
//# sourceMappingURL=build-url.js.map
{
"name": "build-url-ts",
"version": "5.0.9",
"version": "6.0.0",
"description": "A small library that builds a URL given its components",
"main": "./dist/build-url.js",
"types": "./dist/src/build-url.d.ts",
"types": "./dist/build-url.d.ts",
"scripts": {
"build": "NODE_ENV=production rollup -c ./rollup.config.js",
"build": "rollup -c ./rollup.config.js",
"build:prod": "NODE_ENV=production rollup -c ./rollup.config.js",
"lint-js": "eslint src/**/*.ts",
"prepublishOnly": "rollup -c ./rollup.config.js",
"prepublishOnly": "rm -rf dist/* && NODE_ENV=production rollup -c ./rollup.config.js",
"test": "jest",

@@ -37,2 +38,7 @@ "test-watch": "jest --watch",

"author": "Steve Rydz",
"maintainers": [
{
"name": "Mohamed Meabed"
}
],
"license": "MIT",

@@ -50,11 +56,11 @@ "bugs": {

"@types/jasmine": "3.5.14",
"@types/jest": "26.0.10",
"@types/jest": "26.0.12",
"@types/prettier": "2.1.0",
"@typescript-eslint/eslint-plugin": "3.10.1",
"@typescript-eslint/parser": "3.10.1",
"eslint": "7.7.0",
"@typescript-eslint/eslint-plugin": "4.0.1",
"@typescript-eslint/parser": "4.0.1",
"eslint": "7.8.0",
"eslint-config-prettier": "6.11.0",
"jest": "26.4.2",
"prettier": "2.1.1",
"rollup": "2.26.8",
"rollup": "2.26.9",
"rollup-plugin-uglify": "^6.0.4",

@@ -61,0 +67,0 @@ "ts-jest": "26.3.0",

@@ -1,2 +0,2 @@

# build-url-ts
# build-url-ts ( Typescript )

@@ -9,2 +9,4 @@ [![Build Status](https://travis-ci.org/meabed/build-url.svg?branch=master)](https://travis-ci.org/meabed/build-url)

> CodeSandBox Demo: https://codesandbox.io/s/build-url-ts-demo-qer8y
## Installation

@@ -11,0 +13,0 @@

Sorry, the diff of this file is not supported yet

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