Registry / gaming / swu-database

swu-database

JSON →
library1.1.1jsnpmunverified

A database of all cards from the Star Wars: Unlimited TCG by Fantasy Flight Games. Version 1.1.1 provides card data in multiple formats (YAML, JSON, etc.) and direct JavaScript imports. Data is organized by set, and updates are community-contributed. The package ships TypeScript types and is primarily used for building apps, deck builders, or reference tools for the SWU game. Release cadence is irregular as new sets are released by FFG.

npm install swu-database
INSTALL
IMPORT
SIG · SWU-DATABASE
S
swu-database
gamingjavascriptv1.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SOR
import { SOR } from 'swu-database'
const SOR = require('swu-database')
SOR is a named export, not default. Use named import syntax.
allSets
import { allSets } from 'swu-database'
import allSets from 'swu-database'
allSets is a named export containing all set data aggregated.
getCards
import { getCards } from 'swu-database'
import { getCards } from 'swu-database'
getCards is a helper function to retrieve cards by set code or filter criteria.

Demonstrates importing a specific set (SOR), all sets, and using a filtering function to get cards by set code.

// Install: npm install swu-database import { SOR, allSets, getCards } from 'swu-database'; // Get Spark of Rebellion set cards console.log('SOR cards:', SOR.length); // Get all cards from all sets const all = allSets; // Filter by set code const set1Cards = getCards({ set: 'SOR' }); console.log('Filtered cards:', set1Cards.length);
Debug
Known issues
deprecatedThe older method 'loadSet' is deprecated in v1.1.0 and removed in v1.1.1.
fix
Use direct imports like `import { SOR } from 'swu-database'` instead.
affects: >=1.1.0
gotchaData is immutable after import. Modifying imported objects may not work as expected.
fix
Deep clone the data if you need to mutate it: `const cards = JSON.parse(JSON.stringify(SOR));`
affects: >=1.0.0
gotchaCard IDs are unique only within a set, not across all sets.
fix
Use set code + card ID for a globally unique identifier (e.g., 'SOR-001').
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'SOR')
Missing named export or incorrect import syntax.
fix
Use named import: `import { SOR } from 'swu-database';`
Error [ERR_REQUIRE_ESM]: require() of ES Module swu-database not supported
Package is ESM-only (type: module in package.json) and cannot be used with require().
fix
Use import syntax or switch to dynamic import: `import('swu-database')`.
Cannot find module 'swu-database' or its corresponding type declarations.
TypeScript not configured to resolve module or missing @types.
fix
Ensure moduleResolution is 'node' or 'node16' and types are included.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
47 hits · last 30 days
node
40
OpenAI (training)
1
Resources
swu-database — npm install swu-database · libregistry