UNPKG

@jtdc/jtd-dialect

Version:
1 lines 1.71 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="/";function r(e){return null!==e}function t(e){return void 0!==e}function o(e){return Object.keys(e)}function n(e){return!(!e.shallow||!e.errors||0===e.errors.length)}function s(r){return e+r.toString().replace(/~/g,"~0").replace(/\//g,"~1")}function u(e,r,t){return r.errors||(r.errors=[]),r.errors.push({pointer:t,code:e}),!1}function i(e,r){return u("illegal_type",e,r)}function c(e,r){return u("invalid",e,r)}function p(e,r){var t=r.excluded||(r.excluded=new Set);return!t.has(e)&&(t.add(e),!0)}function x(e,r,t){return!n(r)&&(null!=e||u("required",r,t))}function l(e,r,t){return x(e,r,t)&&(Array.isArray(e)||i(r,t))&&p(e,r)}function a(e,r,t){return x(e,r,t)&&("object"==typeof e||i(r,t))&&p(e,r)}function f(e,r,t){return x(e,r,t)&&("string"==typeof e||i(r,t))}function d(e,r,t){return x(e,r,t)&&(Number.isFinite(e)||i(r,t))}function _(e,r,t){return d(e,r,t)&&(Number.isInteger(e)||c(r,t))}function h(e,r,t){return x(e,r,t)&&("boolean"==typeof e||i(r,t))}function b(e,r,t,o){return f(e,t,o)&&(r.includes(e)||c(t,o))}exports.JSON_POINTER_SEPARATOR=e,exports._K=o,exports._N=r,exports._O=t,exports._P=s,exports._R=c,exports._S=e,exports._a=l,exports._b=h,exports._e=b,exports._i=_,exports._n=d,exports._o=a,exports._s=f,exports.checkArray=l,exports.checkBoolean=h,exports.checkEnum=b,exports.checkInteger=_,exports.checkNumber=d,exports.checkObject=a,exports.checkRequired=x,exports.checkString=f,exports.getObjectKeys=o,exports.isNotNullable=r,exports.isNotOptional=t,exports.isValidationCompleted=n,exports.raiseIllegalType=i,exports.raiseInvalid=c,exports.raiseValidationError=u,exports.rejectExcluded=p,exports.toJsonPointer=s;