@conarti/eslint-plugin-feature-sliced
Version:
Feature-sliced design methodology plugin
13 lines (12 loc) • 395 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getByRegExp = void 0;
function getByRegExp(target, regExp, fromEnd = false) {
const results = target.match(regExp) || [];
if (fromEnd) {
const lastResult = results[results.length - 1];
return lastResult || null;
}
return results[0] || null;
}
exports.getByRegExp = getByRegExp;