lib/mongo-xlsx.js
function(value, currentKeyArray) {
    var type = typeof value;
    var pushAnElement = function() {
      var access = currentKeyArray.reduce(buildColumnName);
      if (mongoModelMap[access]) { return; }
      mongoModelMap[access] = access;
      mongoModel.push({
        displayName: access,
        access: access,
        type: type
      });
    };

    switch (type) {
      case "boolean":
      case "number":
      case "string":
        return pushAnElement();

      case "object":
        if (!value) {
          return pushAnElement();
        }
        switch(value.constructor) {
          case Array:
            return searchArray(value, currentKeyArray.slice());
          case Object:
            return searchObject(value, currentKeyArray.slice());
          case Date:
            type = 'date';
            return pushAnElement();
          default:
            if (value.constructor.name === "ObjectID") {
              type = "ObjectID";
              return pushAnElement();
            } else if (value.constructor.name === "InternalCache") {
              // Skip this. Internal mongoose type.
              // Isn't  part of the document.
              return;
            } else {
              console.log("Unknown Object Type:", value.constructor.name);
            }
        }
        break;

      case "symbol":
      case "function":
        return;

      default:
        break;
    }
  }
function(value, currentKeyArray) {
    var type = typeof value;
    var pushAnElement = function() {
      var access = currentKeyArray.reduce(buildColumnName);
      if (mongoModelMap[access]) { return; }
      mongoModelMap[access] = access;
      mongoModel.push({
        displayName: access,
        access: access,
        type: type
      });
    };

    switch (type) {
      case "boolean":
      case "number":
      case "string":
        return pushAnElement();

      case "object":
        if (!value) {
          return pushAnElement();
        }
        switch(value.constructor) {
          case Array:
            return searchArray(value, currentKeyArray.slice());
          case Object:
            return searchObject(value, currentKeyArray.slice());
          case Date:
            type = 'date';
            return pushAnElement();
          default:
            if (value.constructor.name === "ObjectID") {
              type = "ObjectID";
              return pushAnElement();
            } else if (value.constructor.name === "InternalCache") {
              // Skip this. Internal mongoose type.
              // Isn't  part of the document.
              return;
            } else {
              console.log("Unknown Object Type:", value.constructor.name);
            }
        }
        break;

      case "symbol":
      case "function":
        return;

      default:
        break;
    }
  }
function ( value , currentKeyArray ) { var type = typeof value ; var pushAnElement = function ( ) { var access = currentKeyArray . reduce ( buildColumnName ) ; if ( mongoModelMap [ access ] ) { return ; } mongoModelMap [ access ] = access ; mongoModel . push ( { displayName : access , access : access , type : type } ) ; } ; switch ( type ) { case "boolean" : case "number" : case "string" : return pushAnElement ( ) ; case "object" : if ( ! value ) { return pushAnElement ( ) ; } switch ( value . constructor ) { case Array : return searchArray ( value , currentKeyArray . slice ( ) ) ; case Object : return searchObject ( value , currentKeyArray . slice ( ) ) ; case Date : type = 'date' ; return pushAnElement ( ) ; default : if ( value . constructor . name === "ObjectID" ) { type = "ObjectID" ; return pushAnElement ( ) ; } else if ( value . constructor . name === "InternalCache" ) { // Skip this. Internal mongoose type. // Isn't  part of the document. return ; } else { console . log ( "Unknown Object Type:" , value . constructor . name ) ; } } break ; case "symbol" : case "function" : return ; default : break ; } }
For quickly searching if value exist.
For quickly searching if value exist .