All files / src/utilities createProjection.js

100% Statements 7/7
50% Branches 2/4
100% Functions 1/1
100% Lines 7/7

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  7x 7x 7x 7x 15x 15x     7x    
export default function createProjection(customParams) {
    let kyesArray = customParams?.split(",");
    const returnType = { _id: true };
    Eif (kyesArray) {
        for (const key of kyesArray) {
            let rejected = key[0] === "_";
            returnType[rejected ? key.slice(1) : key] = !rejected;
        }
    }
    return returnType;
}