Skip to content
Documentation Menu

Reference

API Reference

The complete function reference for the Finmarks npm package (v0.1.0). All functions return plain data — no classes, no wrappers. Arrays are fresh copies safe to mutate.

import {
  // Entities
  getEntity, mustGetEntity, hasEntity, getAllEntities, getAllEntityIds,
  // Logos
  getLogoUrl, getLogoUrlWithFallback, getLogos, buildLogoUrl,
  // Categories
  getByCategory, getByAllCategories, listCategories, getCategory,
  // Search & lookup
  search, getByIfscPrefix, getByUpiHandle,
  // Constants
  VERSION, CDN_BASE, data,
} from '@finmarks/finmarks';

Entities

getEntity(id)

function getEntity(id: string): Entity | undefined

Look up a single entity. Returns undefined for an unknown id.

mustGetEntity(id)

function mustGetEntity(id: string): Entity

Like getEntity but throws on an unknown id. Use when a missing entity is a programming error.

hasEntity(id)

function hasEntity(id: string): boolean

Returns true if an entity with this id exists.

getAllEntities(options?)

function getAllEntities(options?: FilterOptions): Entity[]

Every entity. Pass { includeInactive: false } to drop anything not active.

getAllEntityIds()

function getAllEntityIds(): string[]

Every entity id, in dataset order.

Logos

getLogoUrl(id, variant?)

function getLogoUrl(id: string, variant?: LogoVariant): string | undefined

CDN URL for one variant, defaulting to 'full'. Returns undefined when the entity is unknown or that variant has not been sourced.

getLogoUrlWithFallback(id, variants?)

function getLogoUrlWithFallback(id: string, variants?: LogoVariant[]): string | undefined

Tries each variant in order and returns the first that exists. Default order: ['full', 'icon'].

getLogos(id)

function getLogos(id: string): LogoUrls

Every available URL for an entity, keyed by variant. Returns a fresh object.

buildLogoUrl(id, filename)

function buildLogoUrl(id: string, filename: string): string

Composes a CDN URL without a dataset lookup. Does not verify the asset exists — prefer getLogoUrl unless you have a reason not to.

Categories

getByCategory(category, options?)

function getByCategory(category: Category | Category[], options?: FilterOptions): Entity[]

Entities in a category, or the union of several, deduped and in dataset order.

getByAllCategories(categories, options?)

function getByAllCategories(categories: Category[], options?: FilterOptions): Entity[]

The intersection — entities holding every listed category.

listCategories()

function listCategories(): CategoryInfo[]

The taxonomy with live entity counts.

getCategory(id)

function getCategory(id: Category): CategoryInfo | undefined

One category's definition and count.

Search & Lookup

search(query, options?)

function search(query: string, options?: SearchOptions): Entity[]

Matches against id, name, short name, legal name, tags, UPI handles and IFSC prefixes. Results are ranked by match quality, then alphabetically.

getByIfscPrefix(prefix)

function getByIfscPrefix(prefix: string): Entity | undefined

Resolves the first four characters of an IFSC code to a bank. Case-insensitive.

getByUpiHandle(handle)

function getByUpiHandle(handle: string): Entity | undefined

Resolves a UPI VPA or handle suffix to its issuing entity. Accepts a full VPA (someone@ybl), a handle with @ (@ybl), or a bare suffix (ybl).

Constants

import { VERSION, CDN_BASE, data } from '@finmarks/finmarks';

VERSION;     // '0.1.0' — dataset version
CDN_BASE;    // 'https://cdn.jsdelivr.net/gh/Finmarks/Finmarks@main'
data;        // the raw EntityIndex

Raw JSON subpaths

import index from 'Finmarks/index.json';
import categories from 'Finmarks/categories.json';