Version 1
[yaffs-website] / node_modules / underscore.string / helper / adjacent.js
diff --git a/node_modules/underscore.string/helper/adjacent.js b/node_modules/underscore.string/helper/adjacent.js
new file mode 100644 (file)
index 0000000..bd26013
--- /dev/null
@@ -0,0 +1,9 @@
+var makeString = require('./makeString');
+
+module.exports = function adjacent(str, direction) {
+  str = makeString(str);
+  if (str.length === 0) {
+    return '';
+  }
+  return str.slice(0, -1) + String.fromCharCode(str.charCodeAt(str.length - 1) + direction);
+};