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

@jsenv/href

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsenv/href - npm Package Compare versions

Comparing version 1.0.0 to 1.2.0

88

dist/commonjs/main.js

@@ -5,40 +5,4 @@ 'use strict';

function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
// eslint-disable-next-line no-undef
if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) !== "object") {
var globalObject;
if (undefined) {
globalObject = undefined;
} else {
// eslint-disable-next-line no-extend-native
Object.defineProperty(Object.prototype, "__global__", {
get: function get() {
return this;
},
configurable: true
}); // eslint-disable-next-line no-undef
globalObject = __global__;
delete Object.prototype.__global__;
}
globalObject.globalThis = globalObject;
}
var hrefToScheme = function hrefToScheme(href) {
var colonIndex = href.indexOf(":");
const hrefToScheme = href => {
const colonIndex = href.indexOf(":");
if (colonIndex === -1) return "";

@@ -48,4 +12,4 @@ return href.slice(0, colonIndex);

var hrefToOrigin = function hrefToOrigin(href) {
var scheme = hrefToScheme(href);
const hrefToOrigin = href => {
const scheme = hrefToScheme(href);

@@ -57,4 +21,4 @@ if (scheme === "file") {

if (scheme === "http" || scheme === "https") {
var secondProtocolSlashIndex = scheme.length + "://".length;
var pathnameSlashIndex = href.indexOf("/", secondProtocolSlashIndex);
const secondProtocolSlashIndex = scheme.length + "://".length;
const pathnameSlashIndex = href.indexOf("/", secondProtocolSlashIndex);
if (pathnameSlashIndex === -1) return href;

@@ -67,8 +31,8 @@ return href.slice(0, pathnameSlashIndex);

var hrefToPathname = function hrefToPathname(href) {
const hrefToPathname = href => {
return ressourceToPathname(hrefToRessource(href));
};
var hrefToRessource = function hrefToRessource(href) {
var scheme = hrefToScheme(href);
const hrefToRessource = href => {
const scheme = hrefToScheme(href);

@@ -81,4 +45,4 @@ if (scheme === "file") {

// remove origin
var afterProtocol = href.slice(scheme.length + "://".length);
var pathnameSlashIndex = afterProtocol.indexOf("/", "://".length);
const afterProtocol = href.slice(scheme.length + "://".length);
const pathnameSlashIndex = afterProtocol.indexOf("/", "://".length);
return afterProtocol.slice(pathnameSlashIndex);

@@ -90,13 +54,11 @@ }

var ressourceToPathname = function ressourceToPathname(ressource) {
var searchSeparatorIndex = ressource.indexOf("?");
const ressourceToPathname = ressource => {
const searchSeparatorIndex = ressource.indexOf("?");
return searchSeparatorIndex === -1 ? ressource : ressource.slice(0, searchSeparatorIndex);
};
var pathnameIsInside = function pathnameIsInside(pathname, otherPathname) {
return pathname.startsWith("".concat(otherPathname, "/"));
};
const pathnameIsInside = (pathname, otherPathname) => pathname.startsWith(`${otherPathname}/`);
var pathnameToDirname = function pathnameToDirname(pathname) {
var slashLastIndex = pathname.lastIndexOf("/");
const pathnameToDirname = pathname => {
const slashLastIndex = pathname.lastIndexOf("/");
if (slashLastIndex === -1) return "";

@@ -106,4 +68,4 @@ return pathname.slice(0, slashLastIndex);

var pathnameToExtension = function pathnameToExtension(pathname) {
var slashLastIndex = pathname.lastIndexOf("/");
const pathnameToExtension = pathname => {
const slashLastIndex = pathname.lastIndexOf("/");

@@ -114,3 +76,3 @@ if (slashLastIndex !== -1) {

var dotLastIndex = pathname.lastIndexOf(".");
const dotLastIndex = pathname.lastIndexOf(".");
if (dotLastIndex === -1) return ""; // if (dotLastIndex === pathname.length - 1) return ""

@@ -121,13 +83,11 @@

var pathnameToRelativePath = function pathnameToRelativePath(pathname, otherPathname) {
return pathname.slice(otherPathname.length);
};
const pathnameToRelativePath = (pathname, otherPathname) => pathname.slice(otherPathname.length);
var ressourceToPathname$1 = function ressourceToPathname(ressource) {
var searchSeparatorIndex = ressource.indexOf("?");
const ressourceToPathname$1 = ressource => {
const searchSeparatorIndex = ressource.indexOf("?");
return searchSeparatorIndex === -1 ? ressource : ressource.slice(0, searchSeparatorIndex);
};
var ressourceToSearch = function ressourceToSearch(ressource) {
var searchSeparatorIndex = ressource.indexOf("?");
const ressourceToSearch = ressource => {
const searchSeparatorIndex = ressource.indexOf("?");
return searchSeparatorIndex === -1 ? "?" : ressource.slice(searchSeparatorIndex);

@@ -134,0 +94,0 @@ };

{
"name": "@jsenv/href",
"version": "1.0.0",
"description": "url helpers not relying on URL constructor",
"version": "1.2.0",
"license": "MIT",

@@ -10,3 +11,4 @@ "repository": {

"publishConfig": {
"access": "public"
"access": "public",
"registry": "https://registry.npmjs.org"
},

@@ -16,3 +18,3 @@ "main": "dist/commonjs/main.js",

"exports": {
"/": "/"
"./": "./"
},

@@ -41,13 +43,15 @@ "files": [

"@dmail/assert": "3.14.0",
"@jsenv/bundling": "3.1.0",
"@jsenv/codecov-upload": "1.7.0",
"@jsenv/eslint-config": "10.0.0",
"@jsenv/execution": "3.1.0",
"@jsenv/node-launcher": "3.2.0",
"@jsenv/node-module-import-map": "6.0.0",
"@jsenv/operating-system-path": "2.4.0",
"@jsenv/prettier-config": "1.0.0",
"@jsenv/prettier-check-project": "3.3.0",
"@jsenv/testing": "2.4.0",
"eslint": "6.2.2",
"@jsenv/auto-publish": "1.9.0",
"@jsenv/bundling": "7.6.2",
"@jsenv/codecov-upload": "2.0.0",
"@jsenv/eslint-config": "10.2.0",
"@jsenv/execution": "6.11.0",
"@jsenv/node-launcher": "4.26.0",
"@jsenv/node-module-import-map": "8.2.1",
"@jsenv/operating-system-path": "2.5.1",
"@jsenv/prettier-config": "1.0.1",
"@jsenv/prettier-check-project": "3.5.0",
"@jsenv/testing": "3.9.0",
"babel-eslint": "11.0.0-beta.0",
"eslint": "6.5.1",
"prettier": "1.18.2",

@@ -54,0 +58,0 @@ "rimraf": "3.0.0"

@@ -1,5 +0,8 @@

# jsenv-href
# Href
[![npm package](https://img.shields.io/npm/v/@jsenv/href.svg)](https://www.npmjs.com/package/@jsenv/href)
[![build](https://travis-ci.com/jsenv/jsenv-href.svg?branch=master)](http://travis-ci.com/jsenv/jsenv-href)
[![codecov](https://codecov.io/gh/jsenv/jsenv-href/branch/master/graph/badge.svg)](https://codecov.io/gh/jsenv/jsenv-href)
[![github package](https://img.shields.io/github/package-json/v/jsenv/jsenv-href.svg?logo=github&label=package)](https://github.com/jsenv/jsenv-href/packages)
[![npm package](https://img.shields.io/npm/v/@jsenv/href.svg?logo=npm&label=package)](https://www.npmjs.com/package/@jsenv/href)
[![github ci](https://github.com/jsenv/jsenv-href/workflows/ci/badge.svg)](https://github.com/jsenv/jsenv-href/actions?workflow=ci)
[![codecov coverage](https://codecov.io/gh/jsenv/jsenv-href/branch/master/graph/badge.svg)](https://codecov.io/gh/jsenv/jsenv-href)
url helpers not relying on URL constructor.

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