include node_modules so release .zip is deployable
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
// nip10.ts
|
||||
function parse(event) {
|
||||
const result = {
|
||||
reply: void 0,
|
||||
root: void 0,
|
||||
mentions: [],
|
||||
profiles: []
|
||||
};
|
||||
const eTags = [];
|
||||
for (const tag of event.tags) {
|
||||
if (tag[0] === "e" && tag[1]) {
|
||||
eTags.push(tag);
|
||||
}
|
||||
if (tag[0] === "p" && tag[1]) {
|
||||
result.profiles.push({
|
||||
pubkey: tag[1],
|
||||
relays: tag[2] ? [tag[2]] : []
|
||||
});
|
||||
}
|
||||
}
|
||||
for (let eTagIndex = 0; eTagIndex < eTags.length; eTagIndex++) {
|
||||
const eTag = eTags[eTagIndex];
|
||||
const [_, eTagEventId, eTagRelayUrl, eTagMarker] = eTag;
|
||||
const eventPointer = {
|
||||
id: eTagEventId,
|
||||
relays: eTagRelayUrl ? [eTagRelayUrl] : []
|
||||
};
|
||||
const isFirstETag = eTagIndex === 0;
|
||||
const isLastETag = eTagIndex === eTags.length - 1;
|
||||
if (eTagMarker === "root") {
|
||||
result.root = eventPointer;
|
||||
continue;
|
||||
}
|
||||
if (eTagMarker === "reply") {
|
||||
result.reply = eventPointer;
|
||||
continue;
|
||||
}
|
||||
if (eTagMarker === "mention") {
|
||||
result.mentions.push(eventPointer);
|
||||
continue;
|
||||
}
|
||||
if (isFirstETag) {
|
||||
result.root = eventPointer;
|
||||
continue;
|
||||
}
|
||||
if (isLastETag) {
|
||||
result.reply = eventPointer;
|
||||
continue;
|
||||
}
|
||||
result.mentions.push(eventPointer);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export {
|
||||
parse
|
||||
};
|
||||
Reference in New Issue
Block a user