github
150 of 152 branches covered (98.68%)
Branch coverage included in aggregate %.
18 of 24 new or added lines in 3 files covered. (75.0%)
413 of 419 relevant lines covered (98.57%)
51.21 hits per line
|
// @ts-check
|
|
|
|
8✔ |
|
/**
|
8✔ |
|
* Converts result into data path mapping |
8✔ |
|
* |
8✔ |
|
* @param {any} data - The data to map. |
8✔ |
|
* @returns {any} The final output. |
8✔ |
|
*/ |
8✔ |
|
const dataPath = (data, paths = '') => { |
8✔ |
NEW
|
return paths.split('/').reduce((final, path) => { |
× |
NEW
|
return (final && final[path]) || data[path] |
× |
NEW
|
}, data) |
× |
NEW
|
} |
× |
|
|
8✔ |
|
module.exports = dataPath |
8✔ |