bit-bin
Version:
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b
26 lines (19 loc) • 665 B
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isValidIdChunk;
function _isString() {
const data = _interopRequireDefault(require("./string/is-string"));
_isString = function () {
return data;
};
return data;
}
const validationRegExp = /^[$\-_!a-z0-9/]+$/;
const validationRegExpDisallowSlash = /^[$\-_!a-z0-9]+$/;
function isValidIdChunk(val, allowSlash = true) {
if (!(0, _isString().default)(val)) return false;
return allowSlash ? validationRegExp.test(val) : validationRegExpDisallowSlash.test(val);
}
;