Skip to content

teclone/industries

Repository files navigation

Industries

Exports list of industry categories, reusable for website implementations, picked from linkedin.

Installation

module is available via npm or yarn

npm install @teclone/industries

Usage

import english translation industries, which is the default. the rest of the locales industries can be imported directly from their file locations.

  • esm module import

    import { industries } from '@teclone/industries';
    industries.forEach((industry) => {
      console.log(industry); // {id: number, linkedinId: number, name: string};
    });
  • cjs import

    const { industries } = require('@teclone/industries');
    industries.forEach((industry) => {
      console.log(industry); // {id: number, linkedinId: number, name: string};
    });
  • esm module import, direct locale specific import

    import industriesInSpanishLocale from '@teclone/industries/build/es/locales/es.json';
    industriesInSpanishLocale.forEach((industry) => {
      console.log(industry); // {id: number, linkedinId: number, name: string};
    });
  • cjs import, working in node.js (server side)

    // require from @teclone/industries/esm/locales/es.json will also work because this is json file
    const industriesInSpanishLocale = require('@teclone/industries/build/cjs/locales/es.json');
    
    industriesInSpanishLocale.forEach((industry) => {
      console.log(industry); // {id: number, linkedinId: number, name: string};
    });

Dynamic import of industries by locale with code-splitting support

import { getIndustriesByLocale } from '@teclone/industries';

const locale = 'fr';

getIndustriesByLocale(locale).then((industries) => {
  industries.forEach((industry) => {
    console.log(industry); // {id: number, linkedinId: number, name: string};
  });
});

Print list of supported locales

import { supportedLocales } from '@teclone/industries';

console.log(supportedLocales);

Export types

import { type Industry, industries } from '@teclone/industries'

const industriesSamples: Industry[] = industries;

industriesSamples.forEach((industry) => {
  console.log(industry); // {id: number, linkedinId: number, name: string};
});

Need to support more locales?

Please create a pull request to support other locales. Thanks

About

Export list of industry categories, reusable for website implementations

Resources

License

Stars

Watchers

Forks

Packages

No packages published