Skip to content

Commit

Permalink
fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Apr 30, 2024
1 parent 7e40b9c commit d2ef10a
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions lib/IAMClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,18 +297,12 @@ class VaultClient {
Version: '2010-05-08',
quotaMax: quota,
};
if (this.disableValidation) {
if (accountName) {
data.AccountName = accountName;
}
} else {
const quotaIsValid = typeof quota === 'number' && !Number.isNaN(Number.parseInt(quota, 10)) && quota > 0;
assert(quotaIsValid, 'Quota must be a strictly positive number');
if (accountName) {
assert(typeof accountName === 'string', 'the account name, if set, should be a string');
data.AccountName = accountName;
}
}
const quotaIsValid = typeof quota === 'number' && !Number.isNaN(Number.parseInt(quota, 10)) && quota > 0;
assert(this.disableValidation || quotaIsValid, 'Quota must be a strictly positive number');
if (accountName) {
assert(this.disableValidation || typeof accountName === 'string', 'the account name, if set, should be a string');

Check failure on line 303 in lib/IAMClient.js

View workflow job for this annotation

GitHub Actions / tests

This line has a length of 128. Maximum allowed is 120
data.AccountName = accountName;
}
this.request('POST', '/', true, callback, data);
}

Expand All @@ -326,9 +320,7 @@ class VaultClient {
};

if (accountName) {
if (!this.disableValidation) {
assert(typeof accountName === 'string', 'the account name, if set, should be a string');
}
assert(this.disableValidation || typeof accountName === 'string', 'the account name, if set, should be a string');

Check failure on line 323 in lib/IAMClient.js

View workflow job for this annotation

GitHub Actions / tests

This line has a length of 126. Maximum allowed is 120
data.AccountName = accountName;
}
this.request('POST', '/', true, callback, data);
Expand All @@ -348,10 +340,8 @@ class VaultClient {
};

if (accountName) {
if (!this.disableValidation) {
assert(typeof accountName === 'string',
'the account name, if set, should be a string');
}
assert(this.disableValidation || typeof accountName === 'string',
'the account name, if set, should be a string');
data.AccountName = accountName;
}
this.request('POST', '/', true, callback, data);
Expand Down

0 comments on commit d2ef10a

Please sign in to comment.