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

fa-constants

v0.2.0

Published

A list of all font awesome icons as js object. Font Awesome by Dave Gandy - http://fontawesome.io

Downloads

4

Readme

fa-constants - All font awesome keys in a constant object

No need to search in the fontawesome list, whether you have written the fa-{{key}} pattern correct or not. This package makes your IDE resolve the list of currently available (latest stable) icon classnames.

Font awesome is distributed under it's own license. This package does not claim any ownership on font awesome.

Install

Use npm to install the package from the npm registry:

npm install --save fa-constants

Import the package to your code:

import { fa } from 'fa-constants';

or use a renamed import in case you want to name it different:

import { fa as FaConstants } from 'fa-constants';

API

keys

Use autocompletion on your IDE to reveal the full list of keys in fa.

Example: insert gif here

toClass ( String ) -> String

Creates a font awesome class from a given icon id.

Example:

// icon id is 'file-o'
fa.toClass(fa.fileo); // 'fa fa-file-o'
toKey ( String ) -> String

Creates a key from a given icon id, that can be attached to an object and can trigger auto completion. Note, that all minus (-) characters are stripped to achieve this.

Example:

// icon id is 'file-o'
fa.toKey('fa-file-o'); // 'fileo
has ( String ) -> Boolean

Returns true/false if a given icon id exists.

Example:

Example:

// icon id is 'file-o'
fa.has(fa.fileo); // true
fa.has('file-o'); // true
fa.has('fa-file-o'); // true
fa.has('fa-filez-o'); // false

Development, Testing and Building

In order to build this package, you can easily make use of the already existing npm scripts.

Buildall

All the commands listed bwloe are wrapped into a chained buildall command. Usually you need only to call this command in order to parse, lint, test and then build the package.

"buildall": "npm run parse && npm run test && npm run build",

Parse

At first, the latest fontawesome icon list needs to be parsed into a JSON Object:

"parse": "node parse.js",

Related: ./parse.js

Build and prepublish

There is a babel build script (for all platforms), that enbles to create a backward compatible ES5 version of the ES6 code:

"build": "node build.js",
"prepublish": "npm run build",

Related: ./build.js

Lint

There are two lint scripts (where one is using --fix) to lint the code using default specifications:

"lint": "eslint -c ./.eslintrc.json ./lib",
"lint-fix": "eslint --fix -c ./.eslintrc.json ./lib"

Note, that lint is automatically run on test.

Related: ./.eslintrc.json

Test

The tests can be executed once or in watch mode:

 "test": "npm run lint && mocha --timeout 15000 --compilers js:babel-core/register --recursive \"tests/*.tests.js\"  \"lib/*.js\"",
 "test:watch": "npm test -- --watch",

Related: ./tests/*

Contribution

You are welcome to open issues and pull requests. Please ensure, that the buildall command is always passing with 0 exit and that your feature request / pull request is backing some sort of use case.