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

@saxx/font-styler

v1.0.2

Published

A simple and flexible Node.js library for fetching and applying custom font styles from FontGen API.

Downloads

250

Readme

Font Styler

Font Styler is a simple and flexible Node.js library that allows you to fetch and apply custom font styles to text using the FontGen API. This library is perfect for creating stylized text for applications, websites, or any project requiring custom fonts.

npm npm npm

Features

  • Fetch a list of available fonts.
  • Apply custom font styles to text dynamically.
  • Easy-to-use API with detailed error handling.
  • Lightweight and efficient.

📊 Statistics

  • Total Downloads: npm
  • Weekly Downloads: npm

Installation

To install the library, use npm:

npm install @saxx/font-styler@latest

Usage

Here’s a quick example of how to use Font Styler:

Importing the Library

const { fontStyle, applyFont, fontStyler, getFontStyle, allFont, listFont, getAllFonts, fetchFonts } = require('@saxx/font-styler');

Applying a Font Style to Text

const { fontStyle, applyFont, fontStyler, getFontStyle, allFont, listFont, getAllFonts, fetchFonts } = require('@saxx/font-styler');

fontStyle('hello', 'monospace').then(result => {
  console.log("Styled Text:", result);
}).catch(err => {
  console.error("Error:", err);
});

Fetching All Available Fonts

const { fontStyle, applyFont, fontStyler, getFontStyle, allFont, listFont, getAllFonts, fetchFonts } = require('@saxx/font-styler');

allFont().then(result => {
  console.log("Available Fonts:", result);
}).catch(err => {
  console.log("Error:", err);
});

API Reference

fontStyle(text: string, font: string)

Applies a custom font style to the given text.

  • Parameters:

    • text (string): The text to style.
    • font (string): The name of the font to apply.
  • Returns: A styled version of the text as a string.

  • Throws: An error if the font is not found or if there is an issue with the API.


allFont()

Fetches a list of all available fonts.

  • Returns: An objects with font_name: "Sample Text".

  • Throws: An error if there is an issue with the API.


Error Handling

The library provides meaningful error messages for issues such as:

  • Font not found.
  • Network errors while accessing the API.

Dependencies

Font Styler depends on the following package:

  • axios for making HTTP requests.

Contributing

Contributions are welcome! If you have any ideas, improvements, or bug fixes, feel free to submit a pull request or open an issue on GitHub.

License

This project is licensed under the ISC License. See the LICENSE file for more details.

Author


Links