dilswer
Version:
Blazingly fast data validation library with TypeScript integration.
54 lines (52 loc) • 1.76 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
// src/validation-algorithms/path.ts
var path_exports = {};
__export(path_exports, {
Path: () => Path
});
module.exports = __toCommonJS(path_exports);
var Path = class _Path {
constructor() {
__publicField(this, "previous");
__publicField(this, "part");
}
static init(root) {
const path = new _Path();
path.part = root;
return path;
}
concat(nextPart) {
const next = new _Path();
next.previous = this;
next.part = nextPart;
return next;
}
flatten() {
const parts = [];
let current = this;
while (current) {
parts.push(current.part.toString());
current = current.previous;
}
return parts.reverse();
}
};