Javascript porting of libdash