You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 408B

123456789101112131415161718192021
  1. 'use strict';
  2. module.exports = function isValidGlob(glob) {
  3. if (typeof glob === 'string' && glob.length > 0) {
  4. return true;
  5. }
  6. if (Array.isArray(glob)) {
  7. return glob.length !== 0 && every(glob);
  8. }
  9. return false;
  10. };
  11. function every(arr) {
  12. var len = arr.length;
  13. while (len--) {
  14. if (typeof arr[len] !== 'string' || arr[len].length <= 0) {
  15. return false;
  16. }
  17. }
  18. return true;
  19. }