bruno
bruno copied to clipboard
mv: function into common
Description
Move isValidValue function into common.js file, also added test for this function
Contribution Checklist:
- [x] The pull request only addresses one issue or adds one feature.
- [x] The pull request does not introduce any breaking changes
- [ ] I have added screenshots or gifs to help explain the change if applicable.
- [x] I have read the contribution guidelines.
- [x] Create an issue and link to the pull request.
@lohit-bruno I'd like to discuss this before this gets merged.
Hey @helloanoop, I have done the changes. Can you please merge this PR. Thanks!
@pooja-bruno I recommend using the fail-early principle to make the condition checks more readable
function decryptString(str) {
if (typeof str !== 'string') {
throw new Error('Decrypt failed: unrecognized string format');
}
if (str.length === 0) {
return '';
}
}
function encryptString(str) {
if (typeof str !== 'string') {
throw new Error('Encrypt failed: invalid string');
}
if (str.length === 0) {
return '';
}
}