Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. function magic(source, keys) {
  2. var result = {};
  3. source.slice(1, -1).split(',').forEach(function(arg) {
  4. var param = arg.split(' ').join('').split('=');
  5. if(keys.indexOf(param[0]) > -1) {
  6. result[param[0]] = param[1];
  7. }
  8. });
  9. return result;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement