CUBRID Node.js driver has this code:
{code}
...
val = val.replace(/[\0\n\r\b\t\\'\x1a]/g, function (s) {
...
{code}
Obviously it will fail if *val* is NULL. Therefore, this function should also check if NULL is passed. If NULL, then return NULL unchanged.