Skip to content

Instantly share code, notes, and snippets.

@serapath
Created September 14, 2016 23:36
Show Gist options
  • Save serapath/b31457f818e9860d879a6ec90c046cd7 to your computer and use it in GitHub Desktop.
Save serapath/b31457f818e9860d879a6ec90c046cd7 to your computer and use it in GitHub Desktop.
cli args
var r={};'hello x=5 hey="cool"'.replace(/([^=\s]+)(?:\s*=\s*(?:"([^"]*?)"|\'([^']*?)\'|(\S*)))?/g,function(_,k,d,s,b){r[k]=d||s||b||true});r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment