All files / latest/src/helpers/pathTransformer index.js

100% Statements 12/12
100% Branches 3/3
100% Functions 1/1
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 131x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
const pathToArrayTransformer = require('./src/pathToArrayTransformer.js');
const pathValidator = require('./src/pathValidator.js');
 
/**
 * Transforms string representation of path into workable array representation
 * @param {any} path - either already transformed path, or string representation of path
 * @param {Object} funcs - object with functions provided by the user that may be part of the query
 * @returns {Array} - array representation of path
 */
const pathTransformer = (path, funcs) => (typeof path === 'string' ? pathToArrayTransformer(path, funcs) : pathValidator(path));
 
module.exports = pathTransformer;