process.mixin deprecated in nodejs

When you are using process.mixin within nodejs 0.1.33, you'll get the following message:

deprecation warning: process.mixin will
be removed from node-core future releases

That this function is not in process anymore, is correct. It has nothing to do with processes. That said, you may think if you really need process.mixin at all. This function is available to create a (deep) copy of an entire object and it's properties.

In my case, I wanted to keep the ability to extend a prototype of an object with an aspect like "Logging".

Thatswhy I called the function

extend and borrowed the implementation from jquery (also licensed under the terms of MIT).

Where to get this "extend"-function from? Option 1: Copy the process.mixin from nodejs 0.1.30 Option 2: Take extend from jquery and modify it so it fits nodejs Option 3: Copy the nodejs version of jquerys extend from my util.js :)

Now I can easily do:

extend(true, Controller.prototype, Logging.prototype)

and every new Controller will have the Logging features, too!

By the way, there's always the possibility to do


if the object does not contain any functions or those are not important to you.

In javascript, jquery, node.js by @ 03 Apr 2010

comments powered by Disqus

Recent Files


Recent Dev-Articles

Read recently