skynet-mysky-utils
Advanced tools
Comparing version 0.2.2 to 0.2.3
# Changelog | ||
## [0.2.3] | ||
### Added | ||
- `removeAdjacentChars` function. | ||
## [0.2.2] | ||
@@ -4,0 +10,0 @@ |
export { getPathDomain, getParentPath, sanitizePath } from "./paths"; | ||
export { Permission, PermCategory, PermType, permCategoryToString, permTypeToString, PermDiscoverable, PermHidden, PermLegacySkyID, PermRead, PermWrite, } from "./permissions"; | ||
export { createFullScreenIframe, createIframe, ensureUrl, trimSuffix, } from "./utils"; | ||
export { createFullScreenIframe, createIframe, ensureUrl, removeAdjacentChars, trimSuffix, } from "./utils"; | ||
export { dispatchedErrorEvent, errorWindowClosed, monitorWindowError, } from "./window-listener"; | ||
@@ -5,0 +5,0 @@ import { Permission } from "./permissions"; |
@@ -10,3 +10,3 @@ "use strict"; | ||
exports.__esModule = true; | ||
exports.defaultHandshakeAttemptsInterval = exports.defaultHandshakeMaxAttempts = exports.monitorWindowError = exports.errorWindowClosed = exports.dispatchedErrorEvent = exports.trimSuffix = exports.ensureUrl = exports.createIframe = exports.createFullScreenIframe = exports.PermWrite = exports.PermRead = exports.PermLegacySkyID = exports.PermHidden = exports.PermDiscoverable = exports.permTypeToString = exports.permCategoryToString = exports.PermType = exports.PermCategory = exports.Permission = exports.sanitizePath = exports.getParentPath = exports.getPathDomain = void 0; | ||
exports.defaultHandshakeAttemptsInterval = exports.defaultHandshakeMaxAttempts = exports.monitorWindowError = exports.errorWindowClosed = exports.dispatchedErrorEvent = exports.trimSuffix = exports.removeAdjacentChars = exports.ensureUrl = exports.createIframe = exports.createFullScreenIframe = exports.PermWrite = exports.PermRead = exports.PermLegacySkyID = exports.PermHidden = exports.PermDiscoverable = exports.permTypeToString = exports.permCategoryToString = exports.PermType = exports.PermCategory = exports.Permission = exports.sanitizePath = exports.getParentPath = exports.getPathDomain = void 0; | ||
var paths_1 = require("./paths"); | ||
@@ -32,2 +32,3 @@ __createBinding(exports, paths_1, "getPathDomain"); | ||
__createBinding(exports, utils_1, "ensureUrl"); | ||
__createBinding(exports, utils_1, "removeAdjacentChars"); | ||
__createBinding(exports, utils_1, "trimSuffix"); | ||
@@ -34,0 +35,0 @@ var window_listener_1 = require("./window-listener"); |
@@ -42,12 +42,3 @@ "use strict"; | ||
// Remove duplicate adjacent slashes. | ||
var pathArray = Array.from(path); | ||
for (var i = 0; i < pathArray.length - 1;) { | ||
if (pathArray[i] === "/" && pathArray[i + 1] === "/") { | ||
pathArray.splice(i, 1); | ||
} | ||
else { | ||
i++; | ||
} | ||
} | ||
path = pathArray.join(""); | ||
path = utils_1.removeAdjacentChars(path, "/"); | ||
return path; | ||
@@ -54,0 +45,0 @@ } |
@@ -10,2 +10,3 @@ /** | ||
export declare function ensureUrl(url: string): string; | ||
export declare function removeAdjacentChars(str: string, char: string): string; | ||
/** | ||
@@ -12,0 +13,0 @@ * Removes a suffix from the end of the string. |
"use strict"; | ||
exports.__esModule = true; | ||
exports.trimSuffix = exports.ensureUrl = exports.createFullScreenIframe = exports.createIframe = void 0; | ||
exports.trimSuffix = exports.removeAdjacentChars = exports.ensureUrl = exports.createFullScreenIframe = exports.createIframe = void 0; | ||
/** | ||
@@ -54,2 +54,15 @@ * Creates an invisible iframe with the given src and adds it to the page. | ||
exports.ensureUrl = ensureUrl; | ||
function removeAdjacentChars(str, char) { | ||
var pathArray = Array.from(str); | ||
for (var i = 0; i < pathArray.length - 1;) { | ||
if (pathArray[i] === char && pathArray[i + 1] === char) { | ||
pathArray.splice(i, 1); | ||
} | ||
else { | ||
i++; | ||
} | ||
} | ||
return pathArray.join(""); | ||
} | ||
exports.removeAdjacentChars = removeAdjacentChars; | ||
/** | ||
@@ -56,0 +69,0 @@ * Removes a suffix from the end of the string. |
{ | ||
"name": "skynet-mysky-utils", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Skynet common MySky utilities", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -19,2 +19,3 @@ export { getPathDomain, getParentPath, sanitizePath } from "./paths"; | ||
ensureUrl, | ||
removeAdjacentChars, | ||
trimSuffix, | ||
@@ -21,0 +22,0 @@ } from "./utils"; |
@@ -1,2 +0,2 @@ | ||
import { trimSuffix } from "./utils"; | ||
import { removeAdjacentChars, trimSuffix } from "./utils"; | ||
@@ -43,13 +43,5 @@ /** | ||
// Remove duplicate adjacent slashes. | ||
const pathArray = Array.from(path); | ||
for (let i = 0; i < pathArray.length - 1; ) { | ||
if (pathArray[i] === "/" && pathArray[i + 1] === "/") { | ||
pathArray.splice(i, 1); | ||
} else { | ||
i++; | ||
} | ||
} | ||
path = pathArray.join(""); | ||
path = removeAdjacentChars(path, "/"); | ||
return path; | ||
} |
@@ -61,2 +61,14 @@ /** | ||
export function removeAdjacentChars(str: string, char: string): string { | ||
const pathArray = Array.from(str); | ||
for (let i = 0; i < pathArray.length - 1; ) { | ||
if (pathArray[i] === char && pathArray[i + 1] === char) { | ||
pathArray.splice(i, 1); | ||
} else { | ||
i++; | ||
} | ||
} | ||
return pathArray.join(""); | ||
} | ||
/** | ||
@@ -63,0 +75,0 @@ * Removes a suffix from the end of the string. |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37564
797