Override the JSON stringify method in process.send()

110 views Asked by At

I am calling process.send(val) with an IPC message between parent and child. The object val has some arbitrary circular references, that are hard to prune, reliably. I have a custom JSON stringify function that can handle circular refs. Is there a way to override the JSON.stringify method within process.send()?

Something like:

const serializableObj = {
  [process.send.stringify](){
      return myCustomStringify(this);
  }
}
0

There are 0 answers