Skip to content

Instantly share code, notes, and snippets.

@okeydoke
Created March 29, 2017 18:11
Show Gist options
  • Save okeydoke/54185eb852c88d807b9dfc076e9a802a to your computer and use it in GitHub Desktop.
Save okeydoke/54185eb852c88d807b9dfc076e9a802a to your computer and use it in GitHub Desktop.
idx
idx = (p, o) => p.replace(/\[/g,'.').replace(/\]/g, '').split('.').reduce((xs, x) => (typeof xs !== 'undefined' && typeof xs[x] !== 'undefined') ? xs[x] : undefined, o)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment