import _ from 'lodash';
import path from 'path';

export default (pattern) => {
    const filename = pattern.to;

    return pattern.toType !== 'file' && (
        path.extname(filename) === '' ||
        _.last(filename) === path.sep ||
        _.last(filename) === '/' ||
        pattern.toType === 'dir'
    );
};

import _ from 'lodash';
import path from 'path';

export default (pattern) => {
    const filename = pattern.to || '';

    return pattern.toType !== 'file' && (
        path.extname(filename) === '' ||
        _.last(filename) === path.sep ||
        _.last(filename) === '/' ||
        pattern.toType === 'dir'
    );
};

Fix ERROR in Path must be a string. Received undefined
Fix ERROR in Path must be a string. Received undefined

this error happens when user omits pattern.to property
