polestar-ui-kit
Version:
## Install
27 lines (21 loc) • 629 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _polestarUtils = require("polestar-utils");
var _i18n = require("../../i18n");
var checkMaxBytes = function checkMaxBytes(rule, value, callback) {
if (typeof rule.maxBytes === 'undefined') {
throw new Error('you must set maxBytes');
}
if (value && _polestarUtils.StringUtil.isMaxBytes(value, rule.maxBytes)) {
callback((0, _i18n.translate)('uikit:message.max_bytes', {
max: rule.maxBytes
}));
} else {
callback();
}
};
var _default = checkMaxBytes;
exports["default"] = _default;