diff options
author | Philip Giuliani <philip.giuliani@keepinmind.info> | 2018-05-30 16:59:11 +0200 |
---|---|---|
committer | Philip Giuliani <philip.giuliani@keepinmind.info> | 2018-05-30 17:02:07 +0200 |
commit | 41c7dff0e81ccdad8a6ab80322e0f323eb9ac6c1 (patch) | |
tree | f2d05b5256362e4e7d71761b452817279ab17c24 /src/js/utils.js | |
parent | e3bae562fc4cc33af243cee0ae391110dd5db4e7 (diff) | |
download | plyr-41c7dff0e81ccdad8a6ab80322e0f323eb9ac6c1.tar.lz plyr-41c7dff0e81ccdad8a6ab80322e0f323eb9ac6c1.tar.xz plyr-41c7dff0e81ccdad8a6ab80322e0f323eb9ac6c1.zip |
Add getDeep method to utils
Diffstat (limited to 'src/js/utils.js')
-rw-r--r-- | src/js/utils.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/js/utils.js b/src/js/utils.js index 0334879d..e04d56e4 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -728,6 +728,11 @@ const utils = { return JSON.parse(JSON.stringify(object)); }, + // Get a nested value in an object + getDeep(object, value) { + return value.split('.').reduce((obj, key) => obj[key] || {}, object); + }, + // Get the closest value in an array closest(array, value) { if (!utils.is.array(array) || !array.length) { |