diff options
| author | Misko Hevery | 2012-03-16 12:55:54 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2012-03-19 11:41:23 -0700 | 
| commit | d4ae7988dad88af608db9cf34992c9c748eda6aa (patch) | |
| tree | 162afef88669329611d0b0d9e7b6929537c803b8 | |
| parent | 5ac14f633a69f49973b5512780c6ec7752405967 (diff) | |
| download | angular.js-d4ae7988dad88af608db9cf34992c9c748eda6aa.tar.bz2 | |
chore(parseInt): cleanup parseInt() for our int()
| -rw-r--r-- | src/Angular.js | 6 | ||||
| -rw-r--r-- | src/JSON.js | 3 | ||||
| -rw-r--r-- | src/directive/input.js | 4 | ||||
| -rw-r--r-- | src/service/filter/filters.js | 2 | ||||
| -rw-r--r-- | src/service/filter/limitTo.js | 2 | ||||
| -rw-r--r-- | src/service/location.js | 2 | 
6 files changed, 10 insertions, 9 deletions
diff --git a/src/Angular.js b/src/Angular.js index 3c5bfa4b..4ba95d10 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -61,7 +61,7 @@ var $boolean          = 'boolean',      $undefined        = 'undefined',      Error             = window.Error,      /** holds major version number for IE or NaN for real browsers */ -    msie              = parseInt((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1], 10), +    msie              = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]),      jqLite,           // delay binding since jQuery could be loaded after us.      jQuery,           // delay binding      slice             = [].slice, @@ -205,6 +205,10 @@ function extend(dst) {    return dst;  } +function int(str) { +  return parseInt(str, 10); +} +  function inherit(parent, extra) {    return extend(new (extend(function() {}, {prototype:parent}))(), extra); diff --git a/src/JSON.js b/src/JSON.js index 83d1e927..21d526c2 100644 --- a/src/JSON.js +++ b/src/JSON.js @@ -74,9 +74,6 @@ function jsonStringToDate(string){      return date;    }    return string; -  function int(str) { -    return parseInt(str, 10); -  }  }  function jsonDateToString(date){ diff --git a/src/directive/input.js b/src/directive/input.js index 2e1c7fff..adb8102c 100644 --- a/src/directive/input.js +++ b/src/directive/input.js @@ -415,7 +415,7 @@ function textInputType(scope, element, attr, ctrl) {    // min length validator    if (attr.ngMinlength) { -    var minlength = parseInt(attr.ngMinlength, 10); +    var minlength = int(attr.ngMinlength);      var minLengthValidator = function(value) {        if (!isEmpty(value) && value.length < minlength) {          ctrl.$setValidity('minlength', false); @@ -432,7 +432,7 @@ function textInputType(scope, element, attr, ctrl) {    // max length validator    if (attr.ngMaxlength) { -    var maxlength = parseInt(attr.ngMaxlength, 10); +    var maxlength = int(attr.ngMaxlength);      var maxLengthValidator = function(value) {        if (!isEmpty(value) && value.length > maxlength) {          ctrl.$setValidity('maxlength', false); diff --git a/src/service/filter/filters.js b/src/service/filter/filters.js index 2b1fe533..bf09265b 100644 --- a/src/service/filter/filters.js +++ b/src/service/filter/filters.js @@ -326,7 +326,7 @@ function dateFilter($locale) {      format = $locale.DATETIME_FORMATS[format] || format;      if (isString(date)) {        if (NUMBER_STRING.test(date)) { -        date = parseInt(date, 10); +        date = int(date);        } else {          date = jsonStringToDate(date);        } diff --git a/src/service/filter/limitTo.js b/src/service/filter/limitTo.js index 032a8d61..4928fb9a 100644 --- a/src/service/filter/limitTo.js +++ b/src/service/filter/limitTo.js @@ -56,7 +56,7 @@  function limitToFilter(){    return function(array, limit) {      if (!(array instanceof Array)) return array; -    limit = parseInt(limit, 10); +    limit = int(limit);      var out = [],        i, n; diff --git a/src/service/location.js b/src/service/location.js index a7ff103b..1accb993 100644 --- a/src/service/location.js +++ b/src/service/location.js @@ -30,7 +30,7 @@ function matchUrl(url, obj) {    match = {        protocol: match[1],        host: match[3], -      port: parseInt(match[5], 10) || DEFAULT_PORTS[match[1]] || null, +      port: int(match[5]) || DEFAULT_PORTS[match[1]] || null,        path: match[6] || '/',        search: match[8],        hash: match[10]  | 
