Skip to content

Commit 0d5eff1

Browse files
committed
Updated package.json
1 parent 5559cb4 commit 0d5eff1

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

dist/index.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,25 @@ exports.generateRandomCharacters = void 0;
2020
const core_1 = __nccwpck_require__(186);
2121
function generateRandomCharacters() {
2222
return __awaiter(this, void 0, void 0, function* () {
23-
const numOfCharacters = (0, core_1.getInput)("input1");
24-
const startRange = 0x0020;
25-
const endRange = 0x007E;
23+
const numOfChars = (0, core_1.getInput)("numOfChars");
24+
if (Number(numOfChars) < 0) {
25+
throw new TypeError("numOfChars must be a positive integer");
26+
}
27+
// const startRange = 0x0020;
28+
const startRange = (0, core_1.getInput)("startRange");
29+
// const endRange = 0x007e;
30+
const endRange = (0, core_1.getInput)("endRange");
31+
if (Number(startRange) > Number(endRange)) {
32+
throw new TypeError("startRange must be less than or equal to endRange");
33+
}
2634
const result = [];
27-
for (let i = 0; i < Number(numOfCharacters); i++) {
28-
const randomCodePoint = Math.floor(Math.random() * (endRange - startRange + 1)) + startRange;
35+
for (let i = 0; i < Number(numOfChars); i++) {
36+
const randomCodePoint = Math.floor(Math.random() * (Number(endRange) - Number(startRange) + 1)) + Number(startRange);
2937
const randomCharacter = String.fromCodePoint(randomCodePoint);
3038
result.push(randomCharacter);
3139
}
32-
yield (0, core_1.setOutput)("output1", result.join(''));
40+
console.log(result.join(""));
41+
yield (0, core_1.setOutput)("output", result.join(""));
3342
});
3443
}
3544
exports.generateRandomCharacters = generateRandomCharacters;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "github-action-base-ts",
2+
"name": "random-unicode-text-generator",
33
"version": "1.0.0",
4-
"description": "Base Repo for Typescript GitHub Actions",
4+
"description": "Create random unicode text from an input range",
55
"main": "index.js",
66
"scripts": {
77
"test": "jest",

0 commit comments

Comments
 (0)