Code coverage report for sc/libs/charlib.js

Statements: 100% (13 / 13)      Branches: 100% (18 / 18)      Functions: 100% (4 / 4)      Lines: 100% (13 / 13)      Ignored: none     

All files » sc/libs/ » charlib.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 301     1   1   2742     2161     103   103 48   55 26   29 28     1        
(function(sc) {
  "use strict";
 
  require("./libs");
 
  sc.libs.charlib = {
    isAlpha: function(ch) {
      return ("A" <= ch && ch <= "Z") || ("a" <= ch && ch <= "z");
    },
    isNumber: function(ch) {
      return "0" <= ch && ch <= "9";
    },
    toNumber: function(ch) {
      var n = ch.charCodeAt(0);
 
      if (48 <= n && n <= 57) {
        return n - 48;
      }
      if (65 <= n && n <= 90) {
        return n - 55;
      }
      if (97 <= n && n <= 122) {
        return n - 87;
      }
 
      return NaN;
    }
  };
})(sc);