@elevatormedia/socialite
TypeScript icon, indicating that this package has built-in type declarations

1.1.13 • Public • Published

npm version GitHub Workflow Status GitHub npm downloads npm bundle size GitHub issues

🎭 socialite 🎭

Utility package to extract social media usernames from urls and create urls from usernames.

Installation

NPM:

npm i @elevatormedia/socialite

Yarn:

yarn add @elevatormedia/socialite

Basic Usage

This package offers three functions extractUser, buildUrl, & isValidUrl

extractUser

To extract a username from a social media url:

import { extractUser } from '@elevatormedia/socialite';

const rawURL = 'https://www.twitter.com/myUser';

console.log(extractUser(rawURL));

The above will output myUser;

buildUrl

To retrieve the absolute URL from a given username and type (e.g., facebook, instagram, twitter):

import { buildUrl } from '@elevatormedia/socialite';

const rawUsername = 'myUser';
const type = 'facebook';

console.log(buildUrl(rawUsername, type));

The above call will output https://www.facebook.com/myUser;

isValidDomain

To check if a given url is a valid case of a supported social type:

import { isValidDomain } from '@elevatormedia/socialite';

const url = 'https://www.soundcloud.com/myUser';

console.log(isValidDomain(url));

The above call will output true

Full Documentation & Contributing

⚠️ Please see the repo's wiki for the full documentation on running and contributing to this project ⚠️

Package Sidebar

Install

npm i @elevatormedia/socialite

Weekly Downloads

0

Version

1.1.13

License

MIT

Unpacked Size

37.1 kB

Total Files

35

Last publish

Collaborators

  • donald-stolz
  • dallen4