1.2.1 • Published 7 months ago

lib-linkedin-url v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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

1.2.1

7 months ago

1.2.0

1 year ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0-beta.1

2 years ago

1.0.0-beta.0

2 years ago