filename-ends-with
Version:
Check if filename ends with a specific string.
27 lines (21 loc) • 689 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = fEndsWith;
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function fEndsWith(filename, suffixList) {
if (typeof suffixList === 'string') {
return _lodash2.default.endsWith(filename, suffixList);
} else if (Array.isArray(suffixList)) {
var endsWith = false;
_lodash2.default.forEach(suffixList, function (suffix) {
if (_lodash2.default.endsWith(filename, suffix)) {
endsWith = true;
}
});
return endsWith;
}
};;