npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

share-url

v1.2.0

Published

Generates social sharing url strings

Downloads

1,606

Readme

share-url

NPM Version Minzipped size License Known Vulnerabilities Libraries.io dependency status for latest release Total alerts Language grade: JavaScript

Generates social sharing urls without downloading its third party scripts. Adaptable to any UI.

Supported: Facebook, Twitter, Telegram, Whatsapp, Pinterest, Reddit, Linkedin, [e-mail].(#email)

Demo

https://noeldelgado.github.io/share-url/

Dependencies

None

Installation

NPM

npm i share-url --save

Or as a <script> tag from a CDN as ShareUrl:

Unkpkg CDN

<script src="https://unpkg.com/share-url"></script>

jsDelivr CDN

<script src="https://cdn.jsdelivr.net/npm/share-url"></script>

Usage Example

// jsx
<a href={ShareUrl.facebook({ u: 'https://google.com' }}>
	Share on Facebook
</a>
// js
document.querySelector('a').href = ShareUrl.facebook({ u: 'https://google.com' });

facebook

https://developers.facebook.com/docs/plugins/share-button/

https://www.facebook.com/sharer.php?u={url}
ShareUrl.facebook({
  u: 'http://google.com',
});
// => 'https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fgoogle.com'

whatsapp

https://faq.whatsapp.com/general/chats/how-to-use-click-to-chat

https://api.whatsapp.com/send?text={text}
ShareUrl.whatsapp({
  text: 'Check out http://google.com',
});
// => 'https://api.whatsapp.com/send?text=Check%20out%20https%3A%2F%2Fgoogle.com'

telegram

https://core.telegram.org/widgets/share#custom-buttons

https://t.me/share/url?url={url}&text={text}
ShareUrl.telegram({
  url: 'https://google.com',
  text: 'Check out',
});
// => https://t.me/share/url?url=https%3A%2F%2Fgoogle.com&text=Check%20out

twitter

https://developer.twitter.com/en/docs/twitter-for-websites/tweet-button/guides/parameter-reference1

https://twitter.com/share?text={text}&url={url}
ShareUrl.twitter({
  text: 'custom share text',
  in_reply_to: '471716611724812288',
  url: 'https://dev.twitter.com/web/tweet-button',
  hashtags: 'example,demo',
  via: 'twitterdev',
  related: 'twitterapi,twitter',
});
// => 'https://twitter.com/share?text=custom%20share%20text&in_reply_to=471716611724812288&url=https%3A%2F%2Fdev.twitter.com%2Fweb%2Ftweet-button&hashtags=example%2Cdemo&via=twitterdev&related=twitterapi%2Ctwitter'

pinterest

https://developers.pinterest.com/docs/widgets/save/

https://pinterest.com/pin/create/button/?url={url}
ShareUrl.pinterest({
  url: 'http://www.flickr.com/photos/kentbrew/6851755809/',
  media: 'http://farm8.staticflickr.com/7027/6851755809_df5b2051c9_z.jpg',
  description: 'Next Stop Pinterest',
});
// => 'https://pinterest.com/pin/create/button/?url=http%3A%2F%2Fwww.flickr.com%2Fphotos%2Fkentbrew%2F6851755809%2F&media=http%3A%2F%2Ffarm8.staticflickr.com%2F7027%2F6851755809_df5b2051c9_z.jpg&description=Next%20Stop%20Pinterest'

reddit

http://www.reddit.com/buttons/

http://www.reddit.com/submit?url={url}
ShareUrl.reddit({
  url: '//www.reddit.com/buttons',
  title: 'Buttons!',
});
// => 'http://www.reddit.com/submit?url=%2F%2Fwww.reddit.com%2Fbuttons&title=Buttons!'

linkedin

https://developer.linkedin.com/docs/share-on-linkedin

https://linkedin.com/sharing/share-offsite/?url={url}
ShareUrl.linkedin({
  url: 'http://developer.linkedin.com',
});
// => 'https://linkedin.com/sharing/share-offsite/?url=http%3A%2F%2Fdeveloper.linkedin.com'

email

https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Email_links

mailto:{to}?subject={subject}&body={body}
ShareUrl.email({
  to: '[email protected]',
  cc: '[email protected]',
  subject: 'This is the subject',
  body: 'This is the body - https://developer.mozilla.org/',
});
// => 'mailto:[email protected]?cc=nobody%40mozilla.org&subject=This%20is%20the%20subject&body=This%20is%20the%20body%20-%20https%3A%2F%2Fdeveloper.mozilla.org%2F'

License

MIT © Noel Delgado