function checkManifest (manifest) {
  const required = ['name', 'description', 'version', 'dependencies']
  const optional = ['icon', 'author', 'repo', 'license', 'plugins']
  for (let key in manifest) {
    let index = required.indexOf(key)
    let optionalIndex = optional.indexOf(key)
    if (index === -1 && optionalIndex === -1) {
      delete manifest[key]
    } else {
      if (index !== -1) {
        required.splice(index, 1)
      }
      if (optionalIndex !== -1) {
        optional.splice(optionalIndex, 1)
      }
    }
  }
  if (required.length !== 0) {
    throw new Error(`Plugin ${manifest.name} missing required field (${required[0]}) from manifest file`)
  }
  return true
}
/**
 * Checks and cleans the manifest based on the required and optional fields defined within the function
 * Any extra fields in the manifest are removed to prevent people from injecting things through manifests
 * Probably highly unlikely
 *
 * @param {Object} manifest
 * @return {boolean}
 */
Checks and cleans the manifest based on the required and optional fields defined within the function
Any extra fields in the manifest are removed to prevent people from injecting things through manifests
Probably highly unlikely

@param {Object} manifest
@return {boolean}
Checks and cleans the manifest based on the required and optional fields defined within the function Any extra fields in the manifest are removed to prevent people from injecting things through manifests Probably highly unlikely @param { Object } manifest @return { boolean }
function checkManifest (manifest) {
  const required = ['name', 'description', 'version', 'dependencies']
  const optional = ['icon', 'author', 'repo', 'license', 'plugins']
  for (let key in manifest) {
    let index = required.indexOf(key)
    let optionalIndex = optional.indexOf(key)
    if (index === -1 && optionalIndex === -1) {
      delete manifest[key]
    } else {
      if (index !== -1) {
        required.splice(index, 1)
      }
      if (optionalIndex !== -1) {
        optional.splice(optionalIndex, 1)
      }
    }
  }
  if (required.length !== 0) {
    throw new Error(`Plugin ${manifest.name} missing required field (${required[0]}) from manifest file`)
  }
  return true
}
function checkManifest ( manifest ) { const required = [ 'name' , 'description' , 'version' , 'dependencies' ] const optional = [ 'icon' , 'author' , 'repo' , 'license' , 'plugins' ] for ( let key in manifest ) { let index = required . indexOf ( key ) let optionalIndex = optional . indexOf ( key ) if ( index === - 1 && optionalIndex === - 1 ) { delete manifest [ key ] } else { if ( index !== - 1 ) { required . splice ( index , 1 ) } if ( optionalIndex !== - 1 ) { optional . splice ( optionalIndex , 1 ) } } } if ( required . length !== 0 ) { throw new Error ( ` ${ manifest . name } ${ required [ 0 ] } ` ) } return true }
Checks and cleans the manifest based on the required and optional fields defined within the function
 Any extra fields in the manifest are removed to prevent people from injecting things through manifests
 Probably highly unlikely
Checks and cleans the manifest based on the required and optional fields defined within the function Any extra fields in the manifest are removed to prevent people from injecting things through manifests Probably highly unlikely