Smart functions for javascript (browser and node)