Permalink
Browse files

implementing letter sequentials

  • Loading branch information...
1 parent d031cad commit fc28d56101cc8f4d4b7a02a2d94ae8e67f7d840d @aaronpowell committed Dec 4, 2011
Showing with 17 additions and 5 deletions.
  1. +17 −5 lib/tbd.js
View
@@ -131,11 +131,23 @@
};
utils.sequential = function(start) {
- return function () {
- var x = start;
- start++;
- return x;
- };
+ if (start.constructor === Number) {
+ return function () {
+ var x = start;
+ start++;
+ return x;
+ };
+ } else if (start.constructor === String) {
+ var letters = 'abcdefghijklmnopqrstuvwxyz'.split('');
+ start = letters.indexOf(start);
+ return function () {
+ var x = start;
+ start++;
+ return letters[x];
+ };
+ } else {
+ throw 'This type is not supported for sequential values at the moment';
+ }
};
this.tbd.utils = utils;

0 comments on commit fc28d56

Please sign in to comment.