code: function getBinaryCase (str, val) {
      let res = '';
  
      for (let i = 0; i < str.length; i++) {
          const code = str.charCodeAt(i);
  
          if (code >= 65 && code <= 90) {
              res += val & 1 ? String.fromCharCode(code + 32) : String.fromCharCode(code);
              val >>>= 1;
          } else if (code >= 97 && code <= 122) {
              res += val & 1 ? String.fromCharCode(code - 32) : String.fromCharCode(code);
              val >>>= 1;
          } else {
              res += String.fromCharCode(code);
          }
  
          if (val === 0) {
              return res + str.substr(i + 1);
          }
      }
  
      return res;
  }
docs: A performance improved method for acquiring the binary case, provided by Blake Embrey with very minor modification by James Speirs.
  @author Blake Embrey | https://github.com/blakeembrey
  @author James Speirs | https://github.com/gi60s
  @param {string} str
  @param {number} val
  @returns {string}