Advertisement
Guest User

cyrus_mc

a guest
Jun 27th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. async function searchAndReplace(files: string, from: RegExp, to: string) {
  2. const replaceInFiles = require('replace-in-file');
  3.  
  4. try {
  5. let options = {
  6. files: files,
  7. from: from,
  8. to: to
  9. }
  10.  
  11. let data = await replaceInFiles(options)
  12. const changedFiles = data
  13. .filter(result => result.hasChanged)
  14. .map(result => result.file)
  15.  
  16. console.log(changedFiles)
  17. } catch (err) {
  18. throw err
  19. }
  20. }
  21.  
  22.  
  23. -----------------
  24. Error
  25.  
  26. lib/index.ts(196,24): error TS7006: Parameter 'result' implicitly has an 'any' type.
  27. lib/index.ts(197,21): error TS7006: Parameter 'result' implicitly has an 'any' type.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement