lib-linkedin-url
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

    

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

Package Sidebar

Install

npm i lib-linkedin-url

Weekly Downloads

89

Version

1.2.1

License

MIT

Unpacked Size

80.3 kB

Total Files

28

Last publish

Collaborators

  • dev-pipelaunch