lib/traverse.js
function getKernelResources(kernelInfo) {
  return promisify(fs.readdir, [kernelInfo.resourceDir]).then(files => {
    const kernelJSONIndex = files.indexOf('kernel.json');
    if (kernelJSONIndex === -1) {
      throw new Error('kernel.json not found');
    }

    return promisify(fs.readFile, [path.join(kernelInfo.resourceDir, 'kernel.json')]).then(data => ({
      name: kernelInfo.name,
      files: files.map(x => path.join(kernelInfo.resourceDir, x)),
      resources_dir: kernelInfo.resourceDir, // eslint-disable-line camelcase
      spec: JSON.parse(data),
    }));
  });
}
function getKernelResources(kernelInfo) {
  return promisify(fs.readdir, [kernelInfo.resourceDir]).then(files => {
    const kernelJSONIndex = files.indexOf('kernel.json');
    if (kernelJSONIndex === -1) {
      throw new Error('kernel.json not found');
    }

    return promisify(fs.readFile, [path.join(kernelInfo.resourceDir, 'kernel.json')]).then(data => ({
      name: kernelInfo.name,
      files: files.map(x => path.join(kernelInfo.resourceDir, x)),
      resources_dir: kernelInfo.resourceDir, // eslint-disable-line camelcase
      spec: JSON.parse(data),
    }));
  });
}
function getKernelResources ( kernelInfo ) { return promisify ( fs . readdir , [ kernelInfo . resourceDir ] ) . then ( files => { const kernelJSONIndex = files . indexOf ( 'kernel.json' ) ; if ( kernelJSONIndex === - 1 ) { throw new Error ( 'kernel.json not found' ) ; } return promisify ( fs . readFile , [ path . join ( kernelInfo . resourceDir , 'kernel.json' ) ] ) . then ( data => ( { name : kernelInfo . name , files : files . map ( x => path . join ( kernelInfo . resourceDir , x ) ) , resources_dir : kernelInfo . resourceDir , // eslint-disable-line camelcase spec : JSON . parse ( data ) , } ) ) ; } ) ; }
Get a kernel resources object
@param  {Object}   kernelInfo              description of a kernel
@param  {string}   kernelInfo.name         name of the kernel
@param  {string}   kernelInfo.resourceDir  kernel's resources directory
@return {Promise<Object>}                  Promise for a kernelResources object
Get a kernel resources object