1 if(!dojo._hasResource["dojox.dtl.filter.integers"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojox.dtl.filter.integers"] = true;
3 dojo.provide("dojox.dtl.filter.integers");
5 dojo.mixin(dojox.dtl.filter.integers, {
6 add: function(value, arg){
7 value = parseInt(value);
9 return isNaN(arg) ? value : value + arg;
11 get_digit: function(value, arg){
13 // Given a whole number, returns the 1-based requested digit of it
15 // 1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the
16 // original value for invalid input (if input or argument is not an integer,
17 // or if argument is less than 1). Otherwise, output is always an integer.
18 value = parseInt(value);
19 arg = parseInt(arg) - 1;
22 if(arg < value.length){
23 value = parseInt(value.charAt(arg));
28 return (isNaN(value) ? 0 : value);