adjacent.js 262 B

123456789
  1. var makeString = require('./makeString');
  2. module.exports = function adjacent(str, direction) {
  3. str = makeString(str);
  4. if (str.length === 0) {
  5. return '';
  6. }
  7. return str.slice(0, -1) + String.fromCharCode(str.charCodeAt(str.length - 1) + direction);
  8. };