psn-api
Version:
A well-tested library that lets you get trophy, user, and game data from the PlayStation Network.
13 lines (12 loc) • 646 B
TypeScript
import { RegionCode } from "../models";
/**
* Extracts the region code from a base64-encoded NPID string and returns the region code.
*
* @param npId The base64-encoded NPID string, which is decoded to extract the region code.
* @returns The ISO 3166-1 alpha-2 region code (e.g., "US", "JP", "GB") as a RegionCode,
* or null if extraction fails or the NPID is invalid.
*
* This function assumes a valid NPID format (e.g., "VaultTec-Co@b7.us"). It splits the string to get
* the region code (e.g., "us"), which is then returned as uppercase.
*/
export declare const extractRegionFromNpId: (npId: string) => RegionCode | null;