JAVASCRIPT   56

index.js

Guest on 12th October 2021 03:02:59 PM

  1. module.exports.twitter = function twitter(username) {
  2.     // Creates the canonical twitter URL without the '@'
  3.     return 'https://twitter.com/' + username.replace(/^@/, '');
  4. };
  5.  
  6. module.exports.facebook = function facebook(username) {
  7.     // Handles a starting slash, this shouldn't happen, but just in case
  8.     return 'https://www.facebook.com/' + username.replace(/^\//, '');
  9. };

Raw Paste


Login or Register to edit or fork this paste. It's free.