"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RegExpRule=void 0;const t=require("./types"),r=e(require("../../../log"));exports.RegExpRule=class{constructor(e,t){this.regEx=e,this.errorCallback=t}validate(e,s,a){a=a||s,r.default.debug("",`start RegExpRule.validate attribute "${a}" in publishJson.`);const i=e[s];i&&!this.regEx.test(i)&&this.errorCallback(a,{attrName:a,ruleType:t.ValidationRuleType.RegExp,errorMsg:this.getErrorMsg(a)}),r.default.debug("",`RegExpRule.validate attribute "${a}" in publishJson succeed.`)}getErrorMsg(e){return`the format of the attribute "${e}" in oh-package.json5 invalid`}};