Initial commit

This commit is contained in:
zhongjin
2020-06-15 10:58:47 +08:00
commit 4f1dfe7564
8590 changed files with 1516878 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
var _ = require('underscore');
module.exports = {
/**
* Get the next available letter.
* @param {Array} letters e.g. ['a', 'b', 'd']
* @return {String} e.g. 'c'
*/
next: function (letters) {
return _.chain(letters)
.sort()
.reduce(function (memo, letter) {
if (letter === memo) {
return String.fromCharCode(letter.charCodeAt() + 1);
} else {
return memo;
}
}, 'a')
.value();
}
};