mirror of
https://github.com/sortedcord/omnia.git
synced 2026-07-22 03:52:48 +05:30
chore: fix linting issues
This commit is contained in:
@@ -10,7 +10,6 @@ export function splitQuotes(text: string): Segment[] {
|
||||
const segments: Segment[] = [];
|
||||
let current = "";
|
||||
let inQuote = false;
|
||||
let quoteChar = "";
|
||||
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
const char = text[i];
|
||||
@@ -78,7 +77,10 @@ export function dehydrate(
|
||||
// 2. Replace names and aliases with entity@<id>[name]
|
||||
sortedNames.forEach((name) => {
|
||||
const id = nameToId.get(name)!;
|
||||
const escapedName = name.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
||||
const escapedName = name.replace(
|
||||
new RegExp("[-/\\\\^$*+?.()|[\\]{}]", "g"),
|
||||
"\\$&",
|
||||
);
|
||||
const regex = new RegExp(`\\b${escapedName}\\b`, "gi");
|
||||
|
||||
text = text.replace(regex, (matched) => {
|
||||
|
||||
@@ -48,7 +48,7 @@ export function hydrate(content: string, viewer: Entity): string {
|
||||
return seg.text.replace(regex, (matchStr, id, original, followingWord) => {
|
||||
const isSelf = id === viewer.id;
|
||||
const lowerOriginal = original.toLowerCase();
|
||||
let resolvedSubject = "";
|
||||
let resolvedSubject: string;
|
||||
let isThirdPersonSingular = false;
|
||||
|
||||
if (isSelf) {
|
||||
@@ -129,7 +129,8 @@ export function hydrate(content: string, viewer: Entity): string {
|
||||
|
||||
if (followingWord) {
|
||||
if (isThirdPersonSingular) {
|
||||
const conj = nlp(followingWord).verbs().conjugate()[0] as any;
|
||||
const conj = nlp(followingWord).verbs().conjugate()[0] as
|
||||
{ Infinitive?: string; PresentTense?: string } | undefined;
|
||||
if (conj && conj.Infinitive === followingWord && conj.PresentTense) {
|
||||
return `${resolvedSubject} ${conj.PresentTense}`;
|
||||
}
|
||||
@@ -194,7 +195,7 @@ export function hydrateObjective(
|
||||
const entity = worldState.getEntity(id);
|
||||
const name = entity?.attributes.get("name")?.getValue() || id;
|
||||
const lowerOriginal = original.toLowerCase();
|
||||
let resolvedSubject = "";
|
||||
let resolvedSubject: string;
|
||||
let isThirdPersonSingular = false;
|
||||
|
||||
if (firstPersonSet.has(lowerOriginal)) {
|
||||
@@ -220,7 +221,8 @@ export function hydrateObjective(
|
||||
|
||||
if (followingWord) {
|
||||
if (isThirdPersonSingular) {
|
||||
const conj = nlp(followingWord).verbs().conjugate()[0] as any;
|
||||
const conj = nlp(followingWord).verbs().conjugate()[0] as
|
||||
{ Infinitive?: string; PresentTense?: string } | undefined;
|
||||
if (conj && conj.Infinitive === followingWord && conj.PresentTense) {
|
||||
return `${resolvedSubject} ${conj.PresentTense}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user