@iden3/js-jsonld-merklization
Version:
json ld merklization library
20 lines (19 loc) • 515 B
JavaScript
import { NodeType } from './types/types';
export class RefTp {
constructor(tp, val) {
this.tp = tp;
this.val = val;
}
toString() {
return JSON.stringify(this);
}
static getRefFromQuad(n) {
if (n.termType === NodeType.IRI) {
return new RefTp(NodeType.IRI, n.value);
}
if (n.termType === NodeType.BlankNode) {
return new RefTp(NodeType.BlankNode, n.value);
}
return new RefTp(NodeType.Undefined, '');
}
}