# word-width

> word-width is simple browserjs / nodejs library for calculate ascii length of unicode string in terminal / console.

Latest version **1.0.1** (published 2017-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install word-width
pnpm add word-width
yarn add word-width
bun add word-width
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-06-05 |
| First published | 2016-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | hustcc |
| Maintainers | atool |
| Keywords | word-width, ascii, ascii-word, ascii width, unicode, unicode width, terminal, console |

## Links

- npm: https://www.npmjs.com/package/word-width
- Repository: https://github.com/hustcc/word-width
- Homepage: https://github.com/hustcc/word-width#readme
- Issues: https://github.com/hustcc/word-width/issues
- npm.io page: https://npm.io/package/word-width

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-06-05
- 1.0.0 — 2016-10-13

## README

# [word-width](http://git.hust.cc/word-width/)

> **word-width** is simple browserjs / nodejs library for calculate ascii length of unicode string in terminal / console.

Inspired by [jquast/wcwidth](https://github.com/jquast/wcwidth) which is written by Python.

[![Build Status](https://travis-ci.org/hustcc/word-width.svg?branch=master)](https://travis-ci.org/hustcc/word-width) [![Coverage Status](https://coveralls.io/repos/github/hustcc/word-width/badge.svg?branch=master)](https://coveralls.io/github/hustcc/word-width?branch=master) [![npm](https://img.shields.io/npm/v/word-width.svg)](https://www.npmjs.com/package/word-width) [![npm](https://img.shields.io/npm/dt/word-width.svg)](https://www.npmjs.com/package/word-width) [![npm](https://img.shields.io/npm/l/word-width.svg)](https://www.npmjs.com/package/word-width)


# 1. Install

> **npm install --save word-width**


# 2. Import It

 - `Script` tag.

```html
<script type="text/javascript" src="dist/word-width.min.js"></script>
```

 - `ES6` style.

```js
var WordWidth = require('word-width');

//or

import WordWidth from 'word-width';
```


# 3. Usage & API

There is only one API named `WordWidth(word)`.

```js
// english
WordWidth('Hello Word Width!');       //17
  
// unicode
WordWidth('コンニチハ, セカイ!');      //19
WordWidth('越过长城，走向世界');       //18
```


# 4. Test

> npm install
> 
> npm test


# 5. LICENSE

MIT

---
_Source: https://npm.io/package/word-width · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
