Created
May 23, 2018 16:38
-
-
Save jpitchardu/6939caa6ad0d26a79c23f628f90cc04f to your computer and use it in GitHub Desktop.
lodashJS._get example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var object = { 'a': [{ 'b': { 'c': 3 } }] }; | |
_.get(object, 'a[0].b.c'); // => 3 | |
_.get(object, ['a', '0', 'b', 'c']); // => 3 | |
_.get(object, 'a.b.c', 'default'); // => 'default' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment