@hedia/test
Advanced tools
Comparing version
@@ -1,1 +0,3 @@ | ||
export declare function randomString(length: number): string; | ||
export declare function randomString(length: number, { asciiOnly }?: { | ||
asciiOnly?: boolean; | ||
}): string; |
@@ -1,3 +0,6 @@ | ||
export function randomString(length) { | ||
const chars = "0123456789abcdefghijklmnopqrstuvwxyzæøåABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ"; | ||
export function randomString(length, { asciiOnly = false } = {}) { | ||
let chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||
if (!asciiOnly) { | ||
chars += "æøåÆØÅ"; | ||
} | ||
let result = ""; | ||
@@ -4,0 +7,0 @@ for (let i = length; i > 0; --i) { |
@@ -13,3 +13,21 @@ import assert from "node:assert"; | ||
}); | ||
it("contains all allowed characters", () => { | ||
const result = randomString(100000); | ||
assert(result.includes("æ")); | ||
assert(result.includes("ø")); | ||
assert(result.includes("å")); | ||
assert(result.includes("Æ")); | ||
assert(result.includes("Ø")); | ||
assert(result.includes("Å")); | ||
}); | ||
it("contains only allowed characters", () => { | ||
const result = randomString(100000, { asciiOnly: true }); | ||
assert(!result.includes("æ")); | ||
assert(!result.includes("ø")); | ||
assert(!result.includes("å")); | ||
assert(!result.includes("Æ")); | ||
assert(!result.includes("Ø")); | ||
assert(!result.includes("Å")); | ||
}); | ||
}); | ||
//# sourceMappingURL=randomString.test.js.map |
{ | ||
"name": "@hedia/test", | ||
"version": "3.1.2", | ||
"version": "3.2.0", | ||
"description": "Tools for testing and reporting", | ||
@@ -44,10 +44,10 @@ "homepage": "https://github.com/hedia-team/test#readme", | ||
"dependencies": { | ||
"@hedia/html": "^2.2.0" | ||
"@hedia/html": "^2.3.0" | ||
}, | ||
"devDependencies": { | ||
"@hedia/eslint-config": "4.0.3", | ||
"@hedia/package-lint": "1.1.1", | ||
"@hedia/prettier-config": "1.0.7", | ||
"@hedia/tsconfig": "2.0.1", | ||
"@types/node": "22.5.4" | ||
"@hedia/eslint-config": "4.1.2", | ||
"@hedia/package-lint": "1.2.1", | ||
"@hedia/prettier-config": "1.2.1", | ||
"@hedia/tsconfig": "2.1.1", | ||
"@types/node": "22.7.5" | ||
}, | ||
@@ -54,0 +54,0 @@ "engines": { |
@@ -1,3 +0,6 @@ | ||
export function randomString(length: number): string { | ||
const chars = "0123456789abcdefghijklmnopqrstuvwxyzæøåABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ"; | ||
export function randomString(length: number, { asciiOnly = false }: { asciiOnly?: boolean } = {}): string { | ||
let chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||
if (!asciiOnly) { | ||
chars += "æøåÆØÅ"; | ||
} | ||
let result = ""; | ||
@@ -4,0 +7,0 @@ for (let i = length; i > 0; --i) { |
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
91867
3.81%857
3.13%Updated