Files
notification-elements-demo/node_modules/@jsonjoy.com/json-pointer/lib/validate.js
Giuliano Silvestro 5d0c9ec7eb Initial commit: notification-elements-demo app
Interactive Angular 19 demo for @sda/notification-elements-ui with
6 sections: Bell & Feed, Notification Center, Inbox, Comments &
Threads, Mention Input, and Full-Featured layout. Includes mock
data, dark mode toggle, and real-time event log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:49:19 +10:00

34 lines
1016 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validatePath = exports.validateJsonPointer = void 0;
const validateJsonPointer = (pointer) => {
if (typeof pointer === 'string') {
if (pointer) {
if (pointer[0] !== '/')
throw new Error('POINTER_INVALID');
if (pointer.length > 1024)
throw new Error('POINTER_TOO_LONG');
}
}
else
(0, exports.validatePath)(pointer);
};
exports.validateJsonPointer = validateJsonPointer;
const { isArray } = Array;
const validatePath = (path) => {
if (!isArray(path))
throw new Error('Invalid path.');
if (path.length > 256)
throw new Error('Path too long.');
for (const step of path) {
switch (typeof step) {
case 'string':
case 'number':
continue;
default:
throw new Error('Invalid path step.');
}
}
};
exports.validatePath = validatePath;