function detectType(s) {
        var key;

        // Check for un-determinable string values:
        if (typeof s === 'string') {
          if (s === '' || s.toLowerCase() === 'null') return null;
        }

        // Try to cast it to a number:
        if ((key = +s) == key) return 'number';

        // Check for string with length:
        if (String(s).length) return 'string';

        // Give up:
        return null;
      }
// We're deliberately returning null if we can't make a good assessment of a value.
We're deliberately returning null if we can't make a good assessment of a value.
We ' re deliberately returning null if we can ' t make a good assessment of a value .
function detectType(s) {
        var key;
        if (typeof s === 'string') {
          if (s === '' || s.toLowerCase() === 'null') return null;
        }
        if ((key = +s) == key) return 'number';
        if (String(s).length) return 'string';
        return null;
      }
function detectType ( s ) { var key ; if ( typeof s === 'string' ) { if ( s === '' || s . toLowerCase ( ) === 'null' ) return null ; } if ( ( key = + s ) == key ) return 'number' ; if ( String ( s ) . length ) return 'string' ; return null ; }
We're deliberately returning null if we can't make a good assessment of a value.
We ' re deliberately returning null if we can ' t make a good assessment of a value .
// Check for un-determinable string values: // Try to cast it to a number: // Check for string with length: // Give up: