npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

gics-data

v1.0.1

Published

Modern library to parse, manipulate, and find GICS codes based on Global Industry Classification Standard by MSCI.

Downloads

60

Readme

GICS

Modern library to parse, manipulate, and find GICS codes based on Global Industry Classification Standard by MSCI. This is an industry standard used widely in Financial Services (GICS code 4020).

Why?

We haven't found modern typescript library for our needs.

Installation

npm install gics-data

Usage

import { 
  getDetails, 
  getDirectChildren, 
  getParent, 
  getLevel, 
  isValid,
  getPositions,
  classificationNested 
} from 'gics-data'

// Get detailed information for a GICS code
const sector = getDetails('10')
console.log(sector) // { code: '10', name: 'Energy', children: {...} }

// Check if a GICS code is valid
console.log(isValid('10')) // true
console.log(isValid('99')) // false

// Get parent of a GICS code
const parent = getParent('1010')
console.log(parent) // { code: '10', name: 'Energy' }

// Get direct children of a GICS code
const children = getDirectChildren('10')
console.log(Object.keys(children)) // ['1010']

// Get all codes at a specific level
const sectors = getLevel(1) // All sectors
const industryGroups = getLevel(2) // All industry groups
const industries = getLevel(3) // All industries
const subIndustries = getLevel(4) // All sub-industries

// Get hierarchy breakdown of a GICS code
const positions = getPositions('10101010')
console.log(positions) // [{ code: '10', name: 'Energy' }, { code: '1010', name: 'Energy' }, ...]

API Reference

getDetails(code: string)

Returns detailed information for a GICS code including name, parent, and children.

  • Returns: ElementNested | undefined

isValid(code: string)

Checks if a GICS code exists in the classification.

  • Returns: boolean

getParent(code: string)

Returns the parent element of a GICS code.

  • Returns: ElementCodified | undefined

getDirectChildren(code: string)

Returns all direct children of a GICS code.

  • Returns: Record<string, ElementCodified> | undefined

getLevel(level?: number)

Returns all GICS codes at a specific hierarchical level.

  • Parameters: level - 1 (sectors), 2 (industry groups), 3 (industries), 4 (sub-industries)
  • Default: 1
  • Returns: Record<string, ElementNested>

getPositions(code: string)

Breaks down a GICS code into each hierarchical position as an array.

  • Parameters: code - The GICS code to break down
  • Returns: Array<ElementCodified> | null - Array containing each level from sector to the specified code, or null if invalid

classificationNested

The complete GICS classification data as a nested object structure.

GICS Hierarchy

The Global Industry Classification Standard has 4 levels:

  • Level 1: Sectors (2-digit codes, e.g., 10 = Energy)
  • Level 2: Industry Groups (4-digit codes, e.g., 1010 = Energy)
  • Level 3: Industries (6-digit codes, e.g., 101010 = Energy Equipment & Services)
  • Level 4: Sub-Industries (8-digit codes, e.g., 10101010 = Oil & Gas Drilling)

Types

export type Element = {
  name: string;
  description?: string;
}

export type ElementCodified = Element & {
  code: string
}

export type ElementNested = ElementCodified & {
  parent?: ElementCodified
  children?: Record<string, ElementCodified>
}

export type ClassificationPosition = Array<ElementCodified>

License

ISC

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.