Socket
Socket
Sign inDemoInstall

poe-text-to-item

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.8 to 1.0.9

dist/models/Base.d.ts

1

dist/index.d.ts
export * from "./utils/generateItem";
export * from "./models/index";

@@ -18,1 +18,2 @@ "use strict";

__exportStar(require("./utils/generateItem"), exports);
__exportStar(require("./models/index"), exports);

21

dist/models/Affix.d.ts

@@ -1,8 +0,19 @@

import { AffixType } from "./enums";
export interface Affix {
text: string;
formatted: string;
header: string;
mod: string;
influence: string;
values: number[];
type: AffixType;
tier: number;
isElevated: boolean;
isNotable: boolean;
isQualityEnhanced: boolean;
affixType: string;
modName: string;
type: string;
modFormatted: string;
modFormattedNoParentheses: string;
modValues: number[];
craftOfExile: {
modgroup: number;
};
modRange: string;
}

@@ -7,3 +7,4 @@ export declare enum AffixType {

Crafted = "crafted",
Veiled = "veiled"
Veiled = "veiled",
Scourged = "scourged"
}

@@ -12,2 +12,3 @@ "use strict";

AffixType["Veiled"] = "veiled";
AffixType["Scourged"] = "scourged";
})(AffixType = exports.AffixType || (exports.AffixType = {}));

@@ -20,2 +20,3 @@ export interface Flags {

veiled: boolean;
scourged: boolean;
}

@@ -0,22 +1,3 @@

import { Affix } from "../models/Affix";
import { Section } from "../models/Section";
export declare function parseAffixes(affixSections: Section[]): Affix[] | undefined;
interface Affix {
header: string;
mod: string;
influence: string;
tier: number;
isElevated: boolean;
isNotable: boolean;
isQualityEnhanced: boolean;
affixType: string;
modName: string;
type: string;
modFormatted: string;
modFormattedNoParentheses: string;
modValues: number[];
craftOfExile: {
modgroup: number;
};
modRange: string;
}
export {};

@@ -28,2 +28,10 @@ "use strict";

}
if (checkScourgedSection(line)) {
// skip helper info
if (line.charAt(0) === "(")
continue;
affixIndex++;
affixPlaceholders[affixIndex] = { header: line, mod: line };
continue;
}
if (checkAffixHeader(line)) {

@@ -45,2 +53,3 @@ affixIndex++;

}
console.log(affixPlaceholders);
return affixPlaceholders.map((affix) => {

@@ -128,2 +137,3 @@ return parsePlaceholder(affix);

.replace(Patterns_1.Patterns.AffixFractured, "")
.replace(Patterns_1.Patterns.AffixScourged, "")
.replace(" — Unscalable Value", "");

@@ -134,2 +144,3 @@ affix.type = Patterns_1.Patterns.AffixEnchant.test(affixString) ? enums_1.AffixType.Enchant : affix.type;

affix.type = Patterns_1.Patterns.AffixFractured.test(affixString) ? enums_1.AffixType.Fractured : affix.type;
affix.type = Patterns_1.Patterns.AffixScourged.test(affixString) ? enums_1.AffixType.Scourged : affix.type;
affix.type = Patterns_1.Patterns.AffixVeiled.test(affixString) ? enums_1.AffixType.Veiled : affix.type;

@@ -158,2 +169,5 @@ // Remove digits from text

};
const checkScourgedSection = (affixString) => {
return Patterns_1.Patterns.AffixScourged.test(affixString);
};
const checkEnchantSection = (affixString) => {

@@ -169,2 +183,6 @@ return Patterns_1.Patterns.AffixEnchant.test(affixString);

}
const scourgedIdx = findSectionIndex(Patterns_1.Patterns.AffixScourged, sections);
if (scourgedIdx !== undefined) {
indices.push(scourgedIdx);
}
// Try to find implicit section

@@ -171,0 +189,0 @@ const implicitIdx = findSectionIndex(Patterns_1.Patterns.AffixImplicit, sections);

import { Section } from "../models/Section";
export declare function parseBaseItem(baseSection: Section): any;
import { Base } from "../models/Base";
export declare function parseBaseItem(baseSection: Section): Base | undefined;

@@ -13,3 +13,3 @@ "use strict";

if (section === undefined) {
return "Unknown";
return undefined;
}

@@ -16,0 +16,0 @@ // if (this.beast !== undefined) {

@@ -25,4 +25,5 @@ "use strict";

veiled: Patterns_1.Patterns.AffixVeiled.test(rawText),
scourged: Patterns_1.Patterns.AffixScourged.test(rawText),
};
}
exports.parseFlags = parseFlags;

@@ -1,1 +0,2 @@

export declare const generateItem: (rawText: string) => {};
import { Item } from "../models/Item";
export declare const generateItem: (rawText: string) => Item;

@@ -27,20 +27,22 @@ "use strict";

});
const item = {};
item.base = (0, parseBaseItem_1.parseBaseItem)(sections[0]);
item.flags = (0, parseFlags_1.parseFlags)(text, item.base.name);
item.talisman = (0, parseTalisman_1.parseTalisman)(text);
item.quality = (0, parseQuality_1.parseQuality)(text);
item.ilvl = (0, parseItemLevel_1.parseItemLevel)(text);
item.requirements = (0, parseRequirements_1.parseRequirements)(text);
item.sockets = (0, parseSockets_1.parseSockets)(text);
item.beast = (0, parseBeast_1.parseBeast)(text);
item.defences = (0, parseDefense_1.parseDefense)(text);
item.offense = (0, parseOffense_1.parseOffense)(text);
item.map = (0, parseMap_1.parseMap)(text);
item.note = (0, parseNote_1.parseNote)(text);
item.stackSize = (0, parseStackSize_1.parseStackSize)(text);
item.affixes = (0, parseAffixes_1.parseAffixes)(sections);
item.icon = (0, getItemIcon_1.getItemIcon)(item.base);
const base = (0, parseBaseItem_1.parseBaseItem)(sections[0]);
const item = {
base: base,
flags: (0, parseFlags_1.parseFlags)(text, base.name),
talisman: (0, parseTalisman_1.parseTalisman)(text),
quality: (0, parseQuality_1.parseQuality)(text),
ilvl: (0, parseItemLevel_1.parseItemLevel)(text),
requirements: (0, parseRequirements_1.parseRequirements)(text),
sockets: (0, parseSockets_1.parseSockets)(text),
beast: (0, parseBeast_1.parseBeast)(text),
defences: (0, parseDefense_1.parseDefense)(text),
offense: (0, parseOffense_1.parseOffense)(text),
map: (0, parseMap_1.parseMap)(text),
note: (0, parseNote_1.parseNote)(text),
stackSize: (0, parseStackSize_1.parseStackSize)(text),
affixes: (0, parseAffixes_1.parseAffixes)(sections),
icon: (0, getItemIcon_1.getItemIcon)(base),
};
return item;
};
exports.generateItem = generateItem;

@@ -28,2 +28,3 @@ export declare const Patterns: {

readonly AffixModQualityEnhanced: RegExp;
readonly AffixScourged: RegExp;
readonly AffixVeiled: RegExp;

@@ -87,2 +88,3 @@ readonly AlternateQuality: RegExp;

readonly Replica: RegExp;
readonly scoured: RegExp;
readonly Requirements: RegExp;

@@ -89,0 +91,0 @@ readonly RequirementsDex: RegExp;

@@ -31,2 +31,3 @@ "use strict";

AffixModQualityEnhanced: /— \d*% Increased }/m,
AffixScourged: / \(scourge\)$/m,
AffixVeiled: /^Veiled\s(?:Suffix|Prefix)$/m,

@@ -90,2 +91,3 @@ AlternateQuality: /^Alternate\sQuality$/m,

Replica: /^Replica$/m,
scoured: /^Scourged$/m,
Requirements: /^Requirements:$/m,

@@ -92,0 +94,0 @@ RequirementsDex: /^Requirements:.+?^Dex:\s(\d+)/ms,

{
"name": "poe-text-to-item",
"version": "1.0.8",
"version": "1.0.9",
"type": "module",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc