Changeset - 6529768a96a2
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 20 months ago 2023-05-30 08:01:53
drewp@bigasterisk.com
stronger types
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
light9/web/SyncedGraph.ts
Show inline comments
 
@@ -356,28 +356,29 @@ export class SyncedGraph {
 
        if (results.length >= howMany) {
 
          return results;
 
        }
 
      }
 
    }
 
    throw new Error(`can't make sequential uri with base ${base}`);
 
  }
 

	
 
  nextNumberedResource(base: any) {
 
    return this.nextNumberedResources(base, 1)[0];
 
  }
 

	
 
  contextsWithPattern(s: any, p: any, o: any) {
 
  contextsWithPattern(s: Quad_Subject | null, p: Quad_Predicate | null, o: Quad_Object | null): N3.NamedNode[] {
 
    this.autoDeps.askedFor(s, p, o, null);
 
    const ctxs = [];
 
    const ctxs: N3.NamedNode[] = [];
 
    for (let q of Array.from(this.graph.getQuads(s, p, o, null))) {
 
      if (q.graph.termType != "NamedNode") throw `context was ${q.graph.id}`;
 
      ctxs.push(q.graph);
 
    }
 
    return unique(ctxs);
 
  }
 

	
 
  sortKey(uri: N3.NamedNode) {
 
    const parts = uri.value.split(/([0-9]+)/);
 
    const expanded = parts.map(function (p: string) {
 
      const f = parseInt(p);
 
      if (isNaN(f)) {
 
        return p;
 
      }
0 comments (0 inline, 0 general)