Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ## FileList
  2. A FileList is a lazy-evaluated list of files. When given a list
  3. of glob patterns for possible files to be included in the file
  4. list, instead of searching the file structures to find the files,
  5. a FileList holds the pattern for latter use.
  6. This allows you to define a FileList to match any number of
  7. files, but only search out the actual files when then FileList
  8. itself is actually used. The key is that the first time an
  9. element of the FileList/Array is requested, the pending patterns
  10. are resolved into a real list of file names.
  11. ### Usage
  12. Add files to the list with the `include` method. You can add glob
  13. patterns, individual files, or RegExp objects. When the Array
  14. methods are invoked on the FileList, these items are resolved to
  15. an actual list of files.
  16. ```javascript
  17. var fl = new FileList();
  18. fl.include('test/*.js');
  19. fl.exclude('test/helpers.js');
  20. ```
  21. Use the `exclude` method to override inclusions. You can use this
  22. when your inclusions are too broad.
  23. ### Array methods
  24. FileList has lazy-evaluated versions of most of the array
  25. methods, including the following:
  26. * join
  27. * pop
  28. * push
  29. * concat
  30. * reverse
  31. * shift
  32. * unshift
  33. * slice
  34. * splice
  35. * sort
  36. * filter
  37. * forEach
  38. * some
  39. * every
  40. * map
  41. * indexOf
  42. * lastIndexOf
  43. * reduce
  44. * reduceRight
  45. When you call one of these methods, the items in the FileList
  46. will be resolved to the full list of files, and the method will
  47. be invoked on that result.
  48. ### Special `length` method
  49. `length`: FileList includes a length *method* (instead of a
  50. property) which returns the number of actual files in the list
  51. once it's been resolved.
  52. ### FileList-specific methods
  53. `include`: Add a filename/glob/regex to the list
  54. `exclude`: Override inclusions by excluding a filename/glob/regex
  55. `resolve`: Resolve the items in the FileList to the full list of
  56. files. This method is invoked automatically when one of the array
  57. methods is called.
  58. `toArray`: Immediately resolves the list of items, and returns an
  59. actual array of filepaths.
  60. `clearInclusions`: Clears any pending items -- must be used
  61. before resolving the list.
  62. `clearExclusions`: Clears the list of exclusions rules.