bruno icon indicating copy to clipboard operation
bruno copied to clipboard

mv: function into common

Open pooja-bruno opened this issue 7 months ago • 1 comments

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.

pooja-bruno avatar May 16 '25 10:05 pooja-bruno

@lohit-bruno I'd like to discuss this before this gets merged.

helloanoop avatar May 22 '25 11:05 helloanoop

Hey @helloanoop, I have done the changes. Can you please merge this PR. Thanks!

pooja-bruno avatar Jun 06 '25 07:06 pooja-bruno

@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 '';
  }
}

helloanoop avatar Jun 06 '25 09:06 helloanoop