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

qrcodets

v1.0.4

Published

qrcodejs with full typescript hint and ES6 export

Downloads

35

Readme

QRCodeTS

QRCodeTS is a TypeScript implementation and packaging of the original QRCodeJS library. It allows you to generate QR codes with various customizable options.

Acknowledgments

This library is based on the original QRCodeJS by davidshimjs.

Installation

To install the package, use npm:

npm i qrcodets

Usage

You can import and use QRCodeTS in your project as follows:

import QRCode from 'qrcodets';

const params = {
    id: 'qrcode',
    element: document.getElementById('qrcode'),
    width: 256,
    height: 256,
    typeNumber: 4,
    colorDark: '#000000',
    colorLight: '#ffffff',
    correctLevel: QRErrorCorrectLevel.H,
    useSVG: false,
    text: 'https://example.com',
    mode: 'svg'
};

const qrCode = new QRCode(params);

Initialization Parameters

The QRCode class takes an object with the following properties as initialization parameters:

  • id (optional): string
    • The ID of the HTML element where the QR code will be rendered.
  • element (optional): HTMLElement
    • The HTML element where the QR code will be rendered. If both id and element are provided, element will be used.
  • width (optional): number
    • The width of the QR code.
  • height (optional): number
    • The height of the QR code.
  • typeNumber (optional): number
    • The QR code version (1-40). Higher values increase the size and data capacity of the QR code.
  • colorDark: string
    • The color of the dark modules (QR code pixels).
  • colorLight: string
    • The color of the light modules (background).
  • correctLevel (optional): QRErrorCorrectLevel
    • The error correction level. Possible values are:
      • QRErrorCorrectLevel.L (Low - ~7% error correction)
      • QRErrorCorrectLevel.M (Medium - ~15% error correction)
      • QRErrorCorrectLevel.Q (Quartile - ~25% error correction)
      • QRErrorCorrectLevel.H (High - ~30% error correction)
  • useSVG (optional): boolean
    • Whether to render the QR code as an SVG.
  • text (optional): string
    • The text or URL to be encoded in the QR code.
  • mode (optional): "svg" | "dom"
    • The rendering mode. Either 'svg' for SVG rendering or 'dom' for HTML DOM rendering.

License

MIT License

Contact

For any questions or issues, please submit issue.


Thank you for using QRCodeTS!