@appolo/utils
Advanced tools
Comparing version 8.0.35 to 8.0.36
@@ -48,3 +48,3 @@ "use strict"; | ||
exports.default = util_1.Util; | ||
(0, tslib_1.__exportStar)(require("./lib/types/types"), exports); | ||
tslib_1.__exportStar(require("./lib/types/types"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -20,2 +20,5 @@ "use strict"; | ||
static removeNewLine(str) { | ||
if (!str) { | ||
return ""; | ||
} | ||
return str.replace(/(\r\n|\n|\r)/gm, ""); | ||
@@ -62,2 +65,5 @@ } | ||
static sanitizeString(str) { | ||
if (!str) { | ||
return ""; | ||
} | ||
// u200B is the hex equivalent of unicode 8203 and it will fuck with our encoding function in the ad server | ||
@@ -69,2 +75,5 @@ // https://stackoverflow.com/questions/24205193/javascript-remove-zero-width-space-unicode-8203-from-string | ||
static removeNonAsciiChars(fromString) { | ||
if (!fromString) { | ||
return ""; | ||
} | ||
if (typeof (fromString) === "string") { | ||
@@ -76,2 +85,5 @@ return fromString.replace(/[^\x00-\x7F]/g, "").replace(/\s\s+/g, ' '); | ||
static slugify(text) { | ||
if (!text) { | ||
return ""; | ||
} | ||
text = (text || "").toString() | ||
@@ -91,2 +103,5 @@ .toLowerCase() | ||
static tryDecodeURIComponent(str) { | ||
if (!str) { | ||
return ""; | ||
} | ||
let [err, output] = index_1.Functions.to(() => decodeURIComponent(str || "")); | ||
@@ -124,2 +139,5 @@ return err ? str || "" : output; | ||
static truncate(input, n) { | ||
if (!input) { | ||
return ""; | ||
} | ||
if (input.length > n) { | ||
@@ -126,0 +144,0 @@ return input.substring(0, n) + '...'; |
import {Functions, Objects} from "../index"; | ||
import {isNull} from "util"; | ||
@@ -23,2 +22,5 @@ const Charset = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+=-" | ||
public static removeNewLine(str: string): string { | ||
if (!str) { | ||
return "" | ||
} | ||
return str.replace(/(\r\n|\n|\r)/gm, ""); | ||
@@ -78,2 +80,7 @@ } | ||
public static sanitizeString(str: string): string { | ||
if (!str) { | ||
return ""; | ||
} | ||
// u200B is the hex equivalent of unicode 8203 and it will fuck with our encoding function in the ad server | ||
@@ -87,2 +94,7 @@ // https://stackoverflow.com/questions/24205193/javascript-remove-zero-width-space-unicode-8203-from-string | ||
public static removeNonAsciiChars(fromString: string): string { | ||
if (!fromString) { | ||
return ""; | ||
} | ||
if (typeof (fromString) === "string") { | ||
@@ -96,2 +108,7 @@ return fromString.replace(/[^\x00-\x7F]/g, "").replace(/\s\s+/g, ' '); | ||
public static slugify(text: string): string { | ||
if (!text) { | ||
return ""; | ||
} | ||
text = (text || "").toString() | ||
@@ -115,2 +132,6 @@ .toLowerCase() | ||
if (!str) { | ||
return ""; | ||
} | ||
let [err, output] = Functions.to(() => decodeURIComponent(str || "")); | ||
@@ -160,3 +181,6 @@ | ||
public static truncate(input:string,n:number):string { | ||
public static truncate(input: string, n: number): string { | ||
if (!input) { | ||
return ""; | ||
} | ||
if (input.length > n) { | ||
@@ -163,0 +187,0 @@ return input.substring(0, n) + '...'; |
@@ -20,3 +20,3 @@ { | ||
"main": "./index.js", | ||
"version": "8.0.35", | ||
"version": "8.0.36", | ||
"license": "MIT", | ||
@@ -23,0 +23,0 @@ "repository": { |
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
237613
4372