javascript: refactor eval generation
javascript: refactor apply generation