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

@pixi/utils

Package Overview
Dependencies
Maintainers
2
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/utils - npm Package Compare versions

Comparing version 7.3.0-rc.2 to 7.3.0

1

lib/path.d.ts

@@ -6,2 +6,3 @@ export interface Path {

isDataUrl: (path: string) => boolean;
isBlobUrl: (path: string) => boolean;
hasProtocol: (path: string) => boolean;

@@ -8,0 +9,0 @@ getProtocol: (path: string) => string;

36

lib/path.js

@@ -59,3 +59,3 @@ "use strict";

/**
* Checks if the path is a URL
* Checks if the path is a URL e.g. http://, https://
* @param path - The path to check

@@ -74,3 +74,10 @@ */

/**
* Checks if the path has a protocol e.g. http://
* Checks if the path is a blob URL
* @param path - The path to check
*/
isBlobUrl(path2) {
return path2.startsWith("blob:");
},
/**
* Checks if the path has a protocol e.g. http://, https://, file:///, data:, blob:, C:/
* This will return true for windows file paths

@@ -80,6 +87,6 @@ * @param path - The path to check

hasProtocol(path2) {
return /^[^/:]+:\//.test(this.toPosix(path2));
return /^[^/:]+:/.test(this.toPosix(path2));
},
/**
* Returns the protocol of the path e.g. http://, C:/, file:///
* Returns the protocol of the path e.g. http://, https://, file:///, data:, blob:, C:/
* @param path - The path to get the protocol from

@@ -89,9 +96,7 @@ */

assertPath(path2), path2 = this.toPosix(path2);
let protocol = "";
const isFile = /^file:\/\/\//.exec(path2), isHttp = /^[^/:]+:\/\//.exec(path2), isWindows = /^[^/:]+:\//.exec(path2);
if (isFile || isHttp || isWindows) {
const arr = isFile?.[0] || isHttp?.[0] || isWindows?.[0];
protocol = arr, path2 = path2.slice(arr.length);
}
return protocol;
const matchFile = /^file:\/\/\//.exec(path2);
if (matchFile)
return matchFile[0];
const matchProtocol = /^[^/:]+:\/{0,2}/.exec(path2);
return matchProtocol ? matchProtocol[0] : "";
},

@@ -108,6 +113,6 @@ /**

toAbsolute(url, customBaseUrl, customRootUrl) {
if (this.isDataUrl(url))
if (assertPath(url), this.isDataUrl(url) || this.isBlobUrl(url))
return url;
const baseUrl = removeUrlParams(this.toPosix(customBaseUrl ?? settings.settings.ADAPTER.getBaseUrl())), rootUrl = removeUrlParams(this.toPosix(customRootUrl ?? this.rootname(baseUrl)));
return assertPath(url), url = this.toPosix(url), url.startsWith("/") ? path.join(rootUrl, url.slice(1)) : this.isAbsolute(url) ? url : this.join(baseUrl, url);
return url = this.toPosix(url), url.startsWith("/") ? path.join(rootUrl, url.slice(1)) : this.isAbsolute(url) ? url : this.join(baseUrl, url);
},

@@ -119,4 +124,7 @@ /**

normalize(path2) {
if (path2 = this.toPosix(path2), assertPath(path2), path2.length === 0)
if (assertPath(path2), path2.length === 0)
return ".";
if (this.isDataUrl(path2) || this.isBlobUrl(path2))
return path2;
path2 = this.toPosix(path2);
let protocol = "";

@@ -123,0 +131,0 @@ const isAbsolute = path2.startsWith("/");

{
"name": "@pixi/utils",
"version": "7.3.0-rc.2",
"version": "7.3.0",
"main": "lib/index.js",

@@ -39,5 +39,5 @@ "module": "lib/index.mjs",

"dependencies": {
"@pixi/color": "7.3.0-rc.2",
"@pixi/constants": "7.3.0-rc.2",
"@pixi/settings": "7.3.0-rc.2",
"@pixi/color": "7.3.0",
"@pixi/constants": "7.3.0",
"@pixi/settings": "7.3.0",
"@types/earcut": "^2.1.0",

@@ -44,0 +44,0 @@ "earcut": "^2.2.4",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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