eve-paste
is a Node.js library that parses copied and pasted data from EVE Online.
It was inspired by evepraisal/evepaste python library but uses a different parsing strategy that makes it a bit more flexible.
-
Lightweight and Dependency-Free
A minimal, efficient library with zero dependencies, ensuring fast performance and easy integration into any project. -
Multiple Parsers
Supports a variety of data types from EVE Online:- Inventory
- Personal Assets
- Contracts
- Multibuy
-
Blueprint Handling
Automatically excludes Blueprint Copies (BPCs), while parsing Blueprint Originals (BPOs) and Formulas. -
Static Data Export (SDE)
Seamlessly integrates fuzzwork's SDE for metadata resolution.
npm i @isk-insider/eve-paste
import { parser } from "@isk-insider/eve-paste";
const result = parser("Tritanium\t1");
console.log(result);
// => {
// items: [{ type_id: 34, type_name: "Tritanium", quantity: 1 }],
// failed_lines: []
// }
Parses raw text_input
into an array of items
.
const input = "Tritanium\t1\nPyerite\t50\nInvalidLine\nTotal:\t4,50";
const result = parser(input);
console.log(result);
// => {
// items: [
// { type_id: 34, type_name: "Tritanium", quantity: 1 },
// { type_id: 35, type_name: "Pyerite", quantity: 50 }
// ],
// failed_lines: ["InvalidLine", "Total:\t4,50"]
// }
-
items
(Array): An array of parsed items with the structure:{ "type_id": number, "type_name": string, "quantity": number }
-
failedLines
(Array): An array of strings representing lines that could not be parsed.
text_input
(string): The raw text input to parse, typically copied from EVE Online.
Splits text_input
into tokens for further processing.
This method runs internally during parser
but can be used independently for advanced cases.
const input = "Tritanium\t1\nPyerite\t50\nChromite: 1,200 mΒ³\nTotal:\t4,50";
const result = tokenize(input);
console.log(result);
// => {
// tokenized_items: [
// { type_name: "Tritanium", quantity: 1 },
// { type_name: "Pyerite", quantity: 50 },
// { type_name: "Chromite", volume: 1200 },
// ],
// failed_lines: ["Total:\t4,50"]
// }
The function performs a best-effort parsing by matching patterns from common scenarios. While it may not always achieve perfect accuracy by itself, it remains practical for the following use cases:
-
Preprocessing Data: Use this function to preprocess raw text data into structured tokens before further processing or querying.
-
Low-Latency Applications: When querying a database for appraisal data, you can bypass the additional lookup process performed by
eve-paste
and directly use the inferredtype_name
. This approach is particularly useful in low-latency applications.
-
tokenized_items
(Array): An array of parsed tokens with the structure:{ "type_name": string, "quantity"?: number, "volume"?: number }
quantity
andvolume
are optional fields and will only be included if they can be inferred from the input data. If neither is parsed, the line will be marked asfailed
. -
failed_lines
(Array): Lines that could not be tokenized.
text_input
(string): The raw text input to parse, typically copied from EVE Online.
Search for metadata associated with a given type_name
in the invTypes SDE.
This method is used internally by the parser
but can also be invoked independently for advanced use cases.
The lookup table can be quite large (~1.4 MB), as it includes all published items from EVE Online.
const typeName = "tritanium";
const result = lookup(typeName);
console.log(result);
// => { type_name: "Tritanium", type_id: 34, type_volume: 0.01 }
{
"type_name"?: string,
"type_id"?: number,
"type_volume"?: number, // repackaged volume of each unit (mΒ³)
}
If no match is found, an empty object is returned.
type_name
(string): The item name to look up.