Giter Site home page Giter Site logo

glob-extra's People

Contributors

dmitriy-kiselyov avatar dudagod avatar levonet avatar oldskytree avatar rostik404 avatar seth2810 avatar sipayrt avatar tadatuta avatar tormozz48 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

glob-extra's Issues

Incorrect expandPaths behavior in 4.0.1

OS: Windows 10.

4.0.0:

node
> const globExtra = require('../lib/index');
> globExtra.expandPaths(['C:\\some_file.txt']).then(a => console.log(a));
[ 'C:/some_file.txt' ]

4.0.1:

node
> const globExtra = require('../lib/index');
> globExtra.expandPaths(['C:\\some_file.txt']).then(a => console.log(a));
[]

This makes Gemini and Hermione unusable.

Throw error or warning if path do not match any file.

Problem:

If we pass array with one or more invalid path they just just skipped. It may be an issue because after calling require('glob-extra').expandPaths we don't know how many paths are not valid or is there any?

Example:

const paths = getArrayFromUserInput(); // ['./right/path/but/with/typoo/5.js', './path/that/do/not/exist/1.js', './path/to/two/or/three/files/*'];
const resolved = require('glob-extra').expandPaths()paths;
functionThatUserExpectsWorkOnFiveLinksButWorksOnFour(paths);

Solution:

Make new option options.errorOnNoMatch that will throw error it any of array's path do not match file.

// glob-extra/lib/index.js:11
const getFilesByMask = (pattern, options) => {
  const files = fg.sync(pattern, options);
  if (options.errorOnNoMatch && files.length == 0) {
    throw new Error('Could not match any files with given patten: ' + pattern);
  }
  return Promise.resolve(files);
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.