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

ascii-lookup

v1.0.4

Published

Get ASCII characters, html codes, hex codes, and decimal codes for different encodings via decimal code or hex code.

Downloads

293

Readme

ascii-lookup

Get ASCII characters, html codes, hex codes, and decimal codes for different encodings via decimal code or hex code.

GitHub release Travis tests codecov Codacy Badge

Install

You can install via npm or yarn.

npm

npm install --save ascii-lookup

yarn

yarn add ascii-lookup

Usage

Importing

You can import using ES6 imports. There are two methods: getASCIIItemForDecimal which will return ASCII info by a given decimal, and getASCIIItemForHex which will return ASCII info by a given hex code.

import { getASCIIItemForDecimal, getASCIIItemForHex } from 'ascii-lookup';

Arguments

getASCIIItemForDecimal accepts two arguments:

| Parameter | Type | Optional | Description | | --------- | ------------------------------------------- | -------- | ----------------------------------------------------------------- | | dec | number | false | The ASCII decimal value | | encoding | string (ASCIIEncoding enum in Typescript) | true | The type of encoding for the extended ASCII set - Default is UTF8 |

getASCIIItemForHex also accepts two arguments:

| Parameter | Type | Optional | Description | | --------- | ------------------------------------------- | -------- | ----------------------------------------------------------------- | | hex | string | false | The ASCII hex value | | encoding | string (ASCIIEncoding enum in Typescript) | true | The type of encoding for the extended ASCII set - Default is UTF8 |

Encodings

If you are using TypeScript you can import the ASCIIEncoding enum which will provide you with every supported encoding:

Example
import { getASCIIItemForDecimal, ASCIIEncoding } from 'ascii-lookup';

getASCIIItemForDecimal(128, ASCIIEncoding.CP437);

If you are using plain JavaScript the available encodings are:

| Encoding | Notes | | ---------------- | ------------------------------ | | cp437 | | | utf-8 | Unicode | | big5 | Chinese | | ibm866 | Russian | | euc-jp | Japanese | | euc-kr | Korean | | gb18030 | Chinese | | iso-8859-1 | Latin1/Western European | | iso-8859-2 | Latin2/Eastern European | | iso-8859-3 | Latin3/South European | | iso-8859-4 | Latin4/North European | | iso-8859-5 | Latin/Cyrillic | | iso-8859-6 | Latin/Arabic | | iso-8859-7 | Latin/Greek | | iso-8859-8 | Latin/Hebrew | | iso-8859-10 | Latin6/Nordic | | iso-8859-13 | Latin7/Baltic Rim | | iso-8859-14 | Latin8/Celtic | | iso-8859-15 | Latin9/Western European | | iso-8859-16 | Latin10/South-Eastern European | | koi8-r | Russian | | koi8-u | Ukrainian | | macintosh | x-mac-roman | | x-mac-cyrillic | | | shift_jis | Japanese | | windows-874 | Thai | | windows-1250 | Eastern European | | windows-1251 | Cyrillic | | windows-1252 | Western European | | windows-1253 | Greek | | windows-1254 | Turkish | | windows-1255 | Hebrew | | windows-1256 | Arabic | | windows-1257 | Baltic | | windows-1258 | Vietnamese |

Result

Both getASCIIItemForDecimal and getASCIIItemForHex return an object of type ASCIIItem:

| Key | Type | Description | | ---- | ------ | ------------ | | dec | number | Decimal code | | hex | string | Hex code | | html | string | HTML code | | char | string | Character |

A type for ASCIIItem is available for import in TypeScript:

import { getASCIIItemForDecimal, ASCIIEncoding, ASCIIItem } from 'ascii-lookup';

const result: ASCIIItem = getASCIIItemForDecimal(128, ASCIIEncoding.CP437);