# power-assert-util-string-width

> calculates width of given string

Latest version **1.2.0** (published 2018-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install power-assert-util-string-width
pnpm add power-assert-util-string-width
yarn add power-assert-util-string-width
bun add power-assert-util-string-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.2.0 |
| Published | 2018-06-12 |
| First published | 2016-10-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Takuto Wada |
| Maintainers | twada |
| Keywords | string, unicode, width |

## Links

- npm: https://www.npmjs.com/package/power-assert-util-string-width
- Repository: https://github.com/twada/power-assert-runtime
- Issues: https://github.com/twada/power-assert-runtime/issues
- npm.io page: https://npm.io/package/power-assert-util-string-width

## Dependencies (1)

- [eastasianwidth](https://npm.io/package/eastasianwidth.md) ^0.2.0

## 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.2.0 (latest) — 2018-06-12
- 1.1.1 — 2016-11-10
- 1.1.0 — 2016-10-07

## README

[![power-assert][power-assert-banner]][power-assert-url]

[![Build Status][travis-image]][travis-url]
[![NPM version][npm-image]][npm-url]
[![License][license-image]][license-url]


Calculates width of given string. Treat ambiguous-width characters as fullwidth (= `2`) by default.


USAGE
---------------------------------------

```js
var stringWidth = require('power-assert-util-string-width');
stringWidth('abcde'); //=> 5
stringWidth('あいうえお'); //=> 10
stringWidth('ｱｲｳｴｵ'); //=> 5
stringWidth('※脚注');  //=> 6
// stringWidth.narrow treats ambiguous-width characters as narrow (= `1`)
stringWidth.narrow('※脚注');  //=> 5
```


INSTALL
---------------------------------------

```sh
$ npm install --save-dev power-assert-util-string-width
```


AUTHOR
---------------------------------------
* [Takuto Wada](https://github.com/twada)


LICENSE
---------------------------------------
Licensed under the [MIT](https://github.com/twada/power-assert-runtime/blob/master/LICENSE) license.


[power-assert-url]: https://github.com/power-assert-js/power-assert
[power-assert-banner]: https://raw.githubusercontent.com/power-assert-js/power-assert-js-logo/master/banner/banner-official-fullcolor.png

[travis-url]: https://travis-ci.org/twada/power-assert-runtime
[travis-image]: https://secure.travis-ci.org/twada/power-assert-runtime.svg?branch=master

[npm-url]: https://npmjs.org/package/power-assert-util-string-width
[npm-image]: https://badge.fury.io/js/power-assert-util-string-width.svg

[license-url]: https://github.com/twada/power-assert-runtime/blob/master/LICENSE
[license-image]: https://img.shields.io/badge/license-MIT-brightgreen.svg

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