Skip to content

Commit

Permalink
fixed 'parse is undefined' issue
Browse files Browse the repository at this point in the history
  • Loading branch information
TimSPb89 committed Jan 22, 2018
1 parent 914ef3b commit 2ab44f0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default {
}),
rollupPluginBabel({
babelrc: false,
runtimeHelpers: true,
runtimeHelpers: false,
presets: [['env', {
modules: false,
targets: {
Expand Down
4 changes: 3 additions & 1 deletion src/parser/WDL/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ async function importParsingStage(ast, opts) {
return result;
}

export default async function parse(data, opts = {}) {
async function parse(data, opts = {}) {
let result = {
status: true,
message: '',
Expand Down Expand Up @@ -468,3 +468,5 @@ export default async function parse(data, opts = {}) {

return result.status ? Promise.resolve(result) : Promise.reject(result.message);
}

export default parse;
11 changes: 8 additions & 3 deletions src/parser/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@ import parseWDL from './WDL/parse';
* @memberOf module:pipeline
* @param {string} text - Text file contents to parse.
* @param {object} [opts={}] - Parser options.
* @param {string} [opts.format='wdl'] - Workflow definition format ('wdl', 'cwl').
* @param {string} [opts.format='wdl'] - Workflow definition format ('wdl').
* @param {file} [opts.zipFile=null] - Zip with import WDL files
* @param {array} [opts.subWfDetailing=null] - Array of Sub Workflow names that should be detailed; if array includes '*' each Sub Workflow will be detailed.
* @param {number} [opts.recursionDepth=0] - Integer that describes Sub Workflow detailing depth
* @param {string} [opts.baseURI=null] - Base URI for WDL import statements
* @returns {Promise} Parsing result object
*/
function parse(text, opts = {}) {
const format = opts.format || 'wdl';
const subWfDetailing = (opts.subWfDetailing && _.isArray(opts.subWfDetailing)) ? opts.subWfDetailing : null;
const recursionDepth = opts.recursionDepth || 0;
const baseURI = opts.baseURI || null;
const zipFile = opts.zipFile || null;

if (format === 'wdl') {
if (opts.zipFile) {
return JSZip.loadAsync(opts.zipFile).then((files) => {
if (zipFile) {
return JSZip.loadAsync(zipFile).then((files) => {
const zipWdlFiles = [];

files.forEach((relativePath, zipEntry) => {
Expand Down

0 comments on commit 2ab44f0

Please sign in to comment.