1.0.0 • Published 6 months ago

evepaste-js v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

evepaste-js

evepaste-js is a Node.js library that parses copied and pasted data from EVE Online.

It was inspired by evepraisal/evepaste but uses a different parsing strategy that makes it a bit more flexible.

Features

  • Parses both inventory and contract items
  • Removes BPCs but parses BPOs and Formulas
  • Capable of parsing volume instead of quantity in some scenarios (beta)

Install

npm install evepaste-js

Usage

import evepaste from "evepaste-js";

const parsedItems = evepaste("Tritanium\t1\nTotal:\t4,50");
console.log(parsedItems);
//=> { items: [{ type_name: "Tritanium", quantity: 1 }], failed: ["Total:\t4,50"] }

API

evepaste(text_input)

Splits text_input into lines and parses each one.

Returns an object containing:

  • items (Array): An array of parsed items. Each item is an object with the following structure:

    {
      "type_name": "string",
      "quantity"?: "number",
      "volume"?: "number"
    }
    • type_name (string): The name of the item, always returned.
    • quantity (number, optional): The quantity of the item.
    • volume (number, optional): The volume in m³.

    Note: quantity and volume 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 as failed.

  • failed (Array): An array of strings representing lines that could not be parsed.

Parameters

text_input

Type: string

The text input to parse, usually copied from EVE Online.

Notes

Output names follow Python-style conventions, making it easy to integrate with ESI or EveRef.

1.0.0

6 months ago

0.1.1

2 years ago

0.1.0

2 years ago