Skip to content

PipeLaunch/lib-linkedin-url

Repository files navigation


    

Linkedin URL


Forks Issues Stars License Npm

Utility library to work with LinkedIn profile URLs: get the canonical url, validate, etc.

Features

  • Supports multiple linkedIn URL formats (including the 'old' ones)
  • Written in typescript
  • With unit tests
  • Zero dependencies

Installation

# Npm
npm install lib-linkedin-url

# Yarn
yarn add lib-linkedin-url

Common usage

import {
  extractCompanyLinkedInProfileName,
  isValidCompanyLinkedInProfileUrl,
} from "lib-linkedin-url";

console.log(
  extractCompanyLinkedInProfileName(
    "https://www.linkedin.com/company/pipelaunch/"
  )
);
// -> pipelaunch

console.log(
  isValidCompanyLinkedInProfileUrl(
    "https://www.linkedin.com/company/pipelaunch/"
  )
);
// -> true

Features

Extract the profile from a URL

extractCompanyLinkedInProfileName(
  "https://www.linkedin.com/company/pipelaunch/"
); // -> pipelaunch

extractLinkedInProfileName("https://www.linkedin.com/in/user/"); // -> user

extractLinkedInProfileName("https://linkedin.com/in/UserR?view=1"); // -> user

Validate LinkedIn profile URL

isValidCompanyLinkedInProfileUrl("https://linkedin.com/company/test"); // -> true

isValidCompanyLinkedInProfileUrl("https://linkedin.com/school/test"); // -> true, school is a "company"

isValidCompanyLinkedInProfileUrl("linkedin.com/in/test"); // -> false (is a person profile)

isValidLinkedInProfileUrl("https://linkedin.com/in/test"); // -> true

Extract Country Name and Country Name

extractLinkedInSubdomain("https://de.linkedin.com/company/test"); // -> de

extractCountryName("https://de.linkedin.com/company/test"); // -> Germany

References

License

MIT

About

Utilities to work with LinkedIn profiles URLs: get the canonical url, validate, etc.

Resources

License

Stars

Watchers

Forks

Packages

No packages published