"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.basename = basename;
exports.isUrlStr = isUrlStr;
exports.isFilePath = isFilePath;
var lodash_1 = require("./lodash");
var is_url_1 = __importDefault(require("is-url"));
function basename(str) {
    if ((0, lodash_1.isEmpty)(str))
        return;
    var base = new String(str).substring(str.lastIndexOf('/') + 1);
    if (base.lastIndexOf('.') > -1) {
        base = base.substring(0, base.lastIndexOf('.'));
    }
    return base;
}
function isUrlStr(str) {
    if ((0, lodash_1.isNil)(str) || (0, lodash_1.isEmpty)(str))
        return false;
    return str.indexOf('/') >= 0 || (0, is_url_1.default)(str);
}
function isFilePath(str, type) {
    if ((0, lodash_1.isNil)(str) || (0, lodash_1.isEmpty)(str))
        return false;
    var bUrl = str.indexOf('/') >= 0 || (0, is_url_1.default)(str);
    var bFile = false;
    if (!(0, lodash_1.isNil)(type) && !(0, lodash_1.isEmpty)(type)) {
        bFile = new RegExp("\\.".concat(type, "$"), 'i').test(str);
    }
    return bUrl || bFile;
}
//# sourceMappingURL=str-utils.js.map