kibana/packages/kbn-eslint-import-resolver-kibana/lib/get_is_path_request.js
2018-04-24 13:49:26 -07:00

17 lines
456 B
JavaScript

// "path" imports point to a specific location and don't require
// module directory resolution. This RegExp should capture import
// statements that:
//
// - start with `./`
// - start with `../`
// - equal `..`
// - equal `.`
// - start with `C:\`
// - start with `C:/`
// - start with `/`
//
const PATH_IMPORT_RE = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/;
exports.getIsPathRequest = function(source) {
return PATH_IMPORT_RE.test(source);
};