PHP's extract() function, ported to JavaScript.