Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

coinmarketcap-s2l

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coinmarketcap-s2l

Symbol to CoinMarketCap Link converter

  • 1.1.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by200%
Maintainers
0
Weekly downloads
 
Created
Source

coinmarketcap-s2l

CoinMarketCap (s)ymbol (2)to (l)ink converter.

import coinmarketcap from 'coinmarketcap-s2l'

coinmarketcap('BTC') // returns https://coinmarketcap.com/currencies/bitcoin/
coinmarketcap('ADA') // returns https://coinmarketcap.com/currencies/cardano/

Installation

npm install coinmarketcap-s2l

Usage

Import in your app to generate link to coinmarketcap

import coinmarketcap from 'coinmarketcap-s2l'

const anchor = document.createElement('a')
anchor.href = coinmarketcap('BTC') // generates the coinmarketcap url from the symbol
anchor.innerText = `go to the BTC coinmarketcap information page`

element.append(anchor)

In a webpage

If you want to use this extension in a static webpage your server needs to accept the cors. Then you have to import the script :

<script type="module">
  import coinmarketcap from './node_modules/coinmarketcap-s2l/index.js'
  window.coinmarketcap = coinmarketcap; // Make the function available globally

  const linkToAdaCoinMarketCapPage = coinmarketcap('ADA')
</script>

Build this module

node ./scripts/coinmarketcap-fetch.mjs
npm run build

Keywords

FAQs

Package last updated on 20 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc