index.js
function resolveScriptPaths (filePath, m) {
  const toParse = [ m ]
  const lookup = {}   // key is module name, value is path

  while (toParse.length) {
    let node = toParse.pop()

    if (node.children)
      for (let n of node.children)
        toParse.push(n)

    if (!node.scripts)
      continue

    for (let entry of node.scripts) {
      let moduleName = camelcase(path.parse(entry.source).name)
      lookup[moduleName] = entry.source
      entry.module = moduleName
    }
  }

  return lookup
}
function resolveScriptPaths (filePath, m) {
  const toParse = [ m ]
  const lookup = {}   // key is module name, value is path

  while (toParse.length) {
    let node = toParse.pop()

    if (node.children)
      for (let n of node.children)
        toParse.push(n)

    if (!node.scripts)
      continue

    for (let entry of node.scripts) {
      let moduleName = camelcase(path.parse(entry.source).name)
      lookup[moduleName] = entry.source
      entry.module = moduleName
    }
  }

  return lookup
}
function resolveScriptPaths ( filePath , m ) { const toParse = [ m ] const lookup = { } // key is module name, value is path while ( toParse . length ) { let node = toParse . pop ( ) if ( node . children ) for ( let n of node . children ) toParse . push ( n ) if ( ! node . scripts ) continue for ( let entry of node . scripts ) { let moduleName = camelcase ( path . parse ( entry . source ) . name ) lookup [ moduleName ] = entry . source entry . module = moduleName } } return lookup }
iterate over a substrate model, resolving all script paths
iterate over a substrate model resolving all script paths