hunk.code_window:   removedPackages.forEach(dependency => {
       delete packageJson[saveType][dependency]
     })
     await writePkg(pkgJsonPath, packageJson)
     return packageJson
  
hunk.labels: keep replace replace replace keep keep keep
hunk.after_edit:     if (!packageJson[saveType]) return packageJson
       removedPackages.forEach(dependency => {
         delete packageJson[saveType][dependency]
       })
     } else {
       dependenciesTypes
         .filter(deptype => packageJson[deptype])
         .forEach(deptype => {
           removedPackages.forEach(dependency => {
             delete packageJson[deptype][dependency]
           })
         })
     }
  
hunk.file_path: src/removeDeps.ts
hunk.type: replace
file: import pLimit = require('p-limit')
  
  type CachedPromises<T> = {
    [name: string]: Promise<T>
  }
  
  export type MemoizedFunc<T> = (key: string, fn: () => Promise<T>) => Promise<T>
  
  /**
   * Save promises for later
   */
  export default function memoize <T>(concurrency?: number): MemoizedFunc<T> {
    const locks: CachedPromises<T> = {}
    const limit = concurrency && pLimit(concurrency)
  
    return function (key: string, fn: () => Promise<T>): Promise<T> {
      if (locks[key]) return locks[key]
      locks[key] = limit && limit(fn) || fn()
      return locks[key]
    }
  }
  