mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-03 06:51:00 +02:00
Merge commit '9b2f675702' as 'ai-context/context-graph-demo'
This commit is contained in:
commit
ecaf3489f1
54 changed files with 10078 additions and 0 deletions
1
ai-context/context-graph-demo/src/utils/index.ts
Normal file
1
ai-context/context-graph-demo/src/utils/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { getLocalName } from "./uri";
|
||||
9
ai-context/context-graph-demo/src/utils/uri.ts
Normal file
9
ai-context/context-graph-demo/src/utils/uri.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* Extract the local name from a URI by taking the fragment after # or the last path segment
|
||||
*/
|
||||
export function getLocalName(uri: string): string {
|
||||
const hashIndex = uri.lastIndexOf("#");
|
||||
const slashIndex = uri.lastIndexOf("/");
|
||||
const index = Math.max(hashIndex, slashIndex);
|
||||
return index >= 0 ? uri.substring(index + 1) : uri;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue