Use nan for node 0.10/0.12 compatibility

This uses the `nan` module for allowing compatibility between different node versions.