Skip to content

Commit 34beb5f

Browse files
committed
Fix nullish coalescing issues
1 parent e6b024a commit 34beb5f

File tree

7 files changed

+19
-23
lines changed

7 files changed

+19
-23
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ module.exports = {
261261
"error"
262262
],
263263
"@typescript-eslint/prefer-nullish-coalescing": [
264-
"error"
264+
"off"
265265
],
266266
"@typescript-eslint/prefer-optional-chain": [
267267
"error"

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## v0.6.6
3+
## v0.6.7
44

55
Refactored to include CLI
66
Rewritten in TypeScript

action/index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,7 +2454,6 @@ const iota_1 = __webpack_require__(586);
24542454
* @returns The config as non partial.
24552455
*/
24562456
function sanitizeInput(config) {
2457-
var _a, _b, _c;
24582457
if (!config.githubToken) {
24592458
throw new Error("You must provide the GitHub token option");
24602459
}
@@ -2476,15 +2475,15 @@ function sanitizeInput(config) {
24762475
if (config.seed.length !== 81) {
24772476
throw new Error(`The seed option must be 81 trytes [A-Z9], it is ${config.seed.length}`);
24782477
}
2479-
config.transactionTag = (_a = config.transactionTag) !== null && _a !== void 0 ? _a : "GITHUB9RELEASE";
2478+
config.transactionTag = config.transactionTag || "GITHUB9RELEASE";
24802479
if (!/[9A-Z]/.test(config.transactionTag)) {
24812480
throw new Error("The transaction tag option must be 27 trytes [A-Z9] or less");
24822481
}
24832482
if (config.transactionTag.length >= 27) {
24842483
throw new Error(`The transaction tag option must be 27 trytes [A-Z9] or less, it is ${config.transactionTag.length}`);
24852484
}
2486-
config.explorerUrl = (_b = config.explorerUrl) !== null && _b !== void 0 ? _b : "https://utils.iota.org/transaction/:hash";
2487-
config.node = (_c = config.node) !== null && _c !== void 0 ? _c : "https://nodes.iota.cafe:443";
2485+
config.explorerUrl = config.explorerUrl || "https://utils.iota.org/transaction/:hash";
2486+
config.node = config.node || "https://nodes.iota.cafe:443";
24882487
let addressIndex;
24892488
let depth;
24902489
let mwm;
@@ -2538,7 +2537,6 @@ exports.sanitizeInput = sanitizeInput;
25382537
* @returns The hash of the transaction and an explorer url.
25392538
*/
25402539
function tangleRelease(config, progress) {
2541-
var _a, _b;
25422540
return __awaiter(this, void 0, void 0, function* () {
25432541
progress("Connecting to GitHub");
25442542
let release;
@@ -2567,8 +2565,8 @@ function tangleRelease(config, progress) {
25672565
const zipBallHash = yield crypto_1.downloadAndHash(release.data.zipball_url);
25682566
progress("Constructing payload");
25692567
const payload = {
2570-
owner: (_a = config.owner) !== null && _a !== void 0 ? _a : "",
2571-
repo: (_b = config.repository) !== null && _b !== void 0 ? _b : "",
2568+
owner: config.owner || "",
2569+
repo: config.repository || "",
25722570
tag_name: release.data.tag_name,
25732571
name: release.data.name,
25742572
comment: config.comment,

dist/core.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const iota_1 = require("./iota");
2020
* @returns The config as non partial.
2121
*/
2222
function sanitizeInput(config) {
23-
var _a, _b, _c;
2423
if (!config.githubToken) {
2524
throw new Error("You must provide the GitHub token option");
2625
}
@@ -42,15 +41,15 @@ function sanitizeInput(config) {
4241
if (config.seed.length !== 81) {
4342
throw new Error(`The seed option must be 81 trytes [A-Z9], it is ${config.seed.length}`);
4443
}
45-
config.transactionTag = (_a = config.transactionTag) !== null && _a !== void 0 ? _a : "GITHUB9RELEASE";
44+
config.transactionTag = config.transactionTag || "GITHUB9RELEASE";
4645
if (!/[9A-Z]/.test(config.transactionTag)) {
4746
throw new Error("The transaction tag option must be 27 trytes [A-Z9] or less");
4847
}
4948
if (config.transactionTag.length >= 27) {
5049
throw new Error(`The transaction tag option must be 27 trytes [A-Z9] or less, it is ${config.transactionTag.length}`);
5150
}
52-
config.explorerUrl = (_b = config.explorerUrl) !== null && _b !== void 0 ? _b : "https://utils.iota.org/transaction/:hash";
53-
config.node = (_c = config.node) !== null && _c !== void 0 ? _c : "https://nodes.iota.cafe:443";
51+
config.explorerUrl = config.explorerUrl || "https://utils.iota.org/transaction/:hash";
52+
config.node = config.node || "https://nodes.iota.cafe:443";
5453
let addressIndex;
5554
let depth;
5655
let mwm;
@@ -104,7 +103,6 @@ exports.sanitizeInput = sanitizeInput;
104103
* @returns The hash of the transaction and an explorer url.
105104
*/
106105
function tangleRelease(config, progress) {
107-
var _a, _b;
108106
return __awaiter(this, void 0, void 0, function* () {
109107
progress("Connecting to GitHub");
110108
let release;
@@ -133,8 +131,8 @@ function tangleRelease(config, progress) {
133131
const zipBallHash = yield crypto_1.downloadAndHash(release.data.zipball_url);
134132
progress("Constructing payload");
135133
const payload = {
136-
owner: (_a = config.owner) !== null && _a !== void 0 ? _a : "",
137-
repo: (_b = config.repository) !== null && _b !== void 0 ? _b : "",
134+
owner: config.owner || "",
135+
repo: config.repository || "",
138136
tag_name: release.data.tag_name,
139137
name: release.data.name,
140138
comment: config.comment,

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@iota/gh-tangle-release",
3-
"version": "0.6.6",
3+
"version": "0.6.7",
44
"description": "Create a release and adds metadata to the IOTA Tangle",
55
"main": "dist/index.js",
66
"module": "es/index.js",

src/core.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function sanitizeInput(config: IPartialConfig): IConfig {
3434
throw new Error(`The seed option must be 81 trytes [A-Z9], it is ${config.seed.length}`);
3535
}
3636

37-
config.transactionTag = config.transactionTag ?? "GITHUB9RELEASE";
37+
config.transactionTag = config.transactionTag || "GITHUB9RELEASE";
3838

3939
if (!/[9A-Z]/.test(config.transactionTag)) {
4040
throw new Error("The transaction tag option must be 27 trytes [A-Z9] or less");
@@ -44,8 +44,8 @@ export function sanitizeInput(config: IPartialConfig): IConfig {
4444
config.transactionTag.length}`);
4545
}
4646

47-
config.explorerUrl = config.explorerUrl ?? "https://utils.iota.org/transaction/:hash";
48-
config.node = config.node ?? "https://nodes.iota.cafe:443";
47+
config.explorerUrl = config.explorerUrl || "https://utils.iota.org/transaction/:hash";
48+
config.node = config.node || "https://nodes.iota.cafe:443";
4949

5050
let addressIndex: number;
5151
let depth: number;
@@ -139,8 +139,8 @@ export async function tangleRelease(config: IConfig, progress: (message: string)
139139

140140
progress("Constructing payload");
141141
const payload: IPayload = {
142-
owner: config.owner ?? "",
143-
repo: config.repository ?? "",
142+
owner: config.owner || "",
143+
repo: config.repository || "",
144144
tag_name: release.data.tag_name,
145145
name: release.data.name,
146146
comment: config.comment,

0 commit comments

Comments
 (0)