lib/enhance/encoding/typecodes.js
function(value) {
      switch (typeof value) {
        case 'undefined':
          return this.undefined;
        case 'string':
          return this.string;
        case 'number':
          if (value % 1 === 0) {
            return this.integer;
          } else {
            return this.double;
          }
          break;
        case 'boolean':
          return this.boolean;
        case 'function':
          return this["function"];
        default:
          if (value === null) {
            return this["null"];
          } else if (value instanceof Date) {
            return this.datetime;
          } else if (value instanceof Array) {
            return this.array;
          } else if (Buffer.isBuffer(value)) {
            throw new TypeError("Value cannot be a buffer");
          } else if (value instanceof Object) {
            return this.object;
          } else {
            throw new TypeError('Value must either be a string, integer, double, boolean, date, array, object or function');
          }
      }
    }
function(value) {
      switch (typeof value) {
        case 'undefined':
          return this.undefined;
        case 'string':
          return this.string;
        case 'number':
          if (value % 1 === 0) {
            return this.integer;
          } else {
            return this.double;
          }
          break;
        case 'boolean':
          return this.boolean;
        case 'function':
          return this["function"];
        default:
          if (value === null) {
            return this["null"];
          } else if (value instanceof Date) {
            return this.datetime;
          } else if (value instanceof Array) {
            return this.array;
          } else if (Buffer.isBuffer(value)) {
            throw new TypeError("Value cannot be a buffer");
          } else if (value instanceof Object) {
            return this.object;
          } else {
            throw new TypeError('Value must either be a string, integer, double, boolean, date, array, object or function');
          }
      }
    }
function ( value ) { switch ( typeof value ) { case 'undefined' : return this . undefined ; case 'string' : return this . string ; case 'number' : if ( value % 1 === 0 ) { return this . integer ; } else { return this . double ; } break ; case 'boolean' : return this . boolean ; case 'function' : return this [ "function" ] ; default : if ( value === null ) { return this [ "null" ] ; } else if ( value instanceof Date ) { return this . datetime ; } else if ( value instanceof Array ) { return this . array ; } else if ( Buffer . isBuffer ( value ) ) { throw new TypeError ( "Value cannot be a buffer" ) ; } else if ( value instanceof Object ) { return this . object ; } else { throw new TypeError ( 'Value must either be a string, integer, double, boolean, date, array, object or function' ) ; } } }
Gets type code value for name.
@method
@param {string} value Value to test type for.
@return {integer} Type code value
Gets type code value for name .