index.js
function chooseDataSource(dataSource) {
        if (dataSource === 'json') {
            return function(file) {
                return JSON.parse(file.contents.toString());
            };
        } else if (dataSource === 'vinyl') {
            return function(file) {
                file[bodyAttribute] = file.contents.toString();
                return file;
            };
        } else if (dataSource === 'data') {
            return function(file) {
                var data = file.data;
                data[bodyAttribute] = file.contents.toString();
                return data;
            };
        } else if (typeof dataSource === 'function') {
            return dataSource;
        } else {
            throw pluginError('Unknown dataSource');
        }
    }
function chooseDataSource(dataSource) {
        if (dataSource === 'json') {
            return function(file) {
                return JSON.parse(file.contents.toString());
            };
        } else if (dataSource === 'vinyl') {
            return function(file) {
                file[bodyAttribute] = file.contents.toString();
                return file;
            };
        } else if (dataSource === 'data') {
            return function(file) {
                var data = file.data;
                data[bodyAttribute] = file.contents.toString();
                return data;
            };
        } else if (typeof dataSource === 'function') {
            return dataSource;
        } else {
            throw pluginError('Unknown dataSource');
        }
    }
Return a function to turn a file object into a JSON-like data object