aureooms/rejuvenate

View on GitHub
src/lib/contains.js

Summary

Maintainability
A
0 mins
Test Coverage
const subroutine = ({assert, read, test, mustExist}) =>
    read().then(test, (error) => {
        if (error.code !== 'ENOENT') throw error;
        if (mustExist) assert.fail(error.message);
    });

const contains = (options) => subroutine({mustExist: true, ...options});

export default contains;