Contracting JavaScript snippets