func & object factory for node.js