index.js
function toMysqlObj(obj) {
  if (obj === undefined || obj === null)
    return "NULL";

  switch (obj.constructor) {
  case Date:
    return `'${formatDate(obj)}'`;

  case String:
    return `'${obj.replace(/'/g, "''")}'`;

  case Number:
    return obj;

  default:
    throw new TypeError(`${util.inspect(obj)}`);
  }
}
function toMysqlObj(obj) {
  if (obj === undefined || obj === null)
    return "NULL";

  switch (obj.constructor) {
  case Date:
    return `'${formatDate(obj)}'`;

  case String:
    return `'${obj.replace(/'/g, "''")}'`;

  case Number:
    return obj;

  default:
    throw new TypeError(`${util.inspect(obj)}`);
  }
}
function toMysqlObj ( obj ) { if ( obj === undefined || obj === null ) return "NULL" ; switch ( obj . constructor ) { case Date : return ` ${ formatDate ( obj ) } ` ; case String : return ` ${ obj . replace ( / ' / g , "''" ) } ` ; case Number : return obj ; default : throw new TypeError ( ` ${ util . inspect ( obj ) } ` ) ; } }
Transform normal Javascript object to Mysql object. Only String, Number,
Date are supported.
Transform normal Javascript object to Mysql object . Only String Number Date are supported .