Phase 1 PWA: prayer times, qibla, quran, hijri, tasbih, 99 names

This commit is contained in:
Hermes Bot
2026-08-06 11:55:47 +08:00
parent 4def05d0ef
commit 0d37e7ec1e
10869 changed files with 959465 additions and 18 deletions
+23
View File
@@ -0,0 +1,23 @@
import { NOT_REGEX, QUOTES_REGEX, SLASH_REGEX } from '../constants';
import pointer from 'jsonpointer';
export const pointerToDotNotation = (pointer: string): string => {
return pointer.replace(SLASH_REGEX, '.');
};
export const cleanAjvMessage = (message: string): string => {
return message.replace(QUOTES_REGEX, "'").replace(NOT_REGEX, 'not');
};
export const getLastSegment = (path: string): string => {
const segments = path.split('/');
return segments.pop() as string;
};
export const safeJsonPointer = <T>({ object, pnter, fallback }: { object: any; pnter: string; fallback: T }): T => {
try {
return pointer.get(object, pnter);
} catch (err) {
return fallback;
}
};