# wcwidth

> Port of C's wcwidth() and wcswidth()

Latest version **1.0.1** (published 2016-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install wcwidth
pnpm add wcwidth
yarn add wcwidth
bun add wcwidth
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-05-30 |
| First published | 2014-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/wcwidth) |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 54 |
| Author | Tim Oxley |
| Maintainers | timoxley |
| Keywords | wide character, wc, wide character string, wcs, terminal, width, wcwidth, wcswidth |

## Links

- npm: https://www.npmjs.com/package/wcwidth
- Repository: https://github.com/timoxley/wcwidth
- Homepage: https://github.com/timoxley/wcwidth#readme
- Issues: https://github.com/timoxley/wcwidth/issues
- npm.io page: https://npm.io/package/wcwidth

## Dependencies (1)

- [defaults](https://npm.io/package/defaults.md) ^1.0.3

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-05-30
- 1.0.0 — 2014-08-11
- 0.0.0 — 2014-07-27

## README

# wcwidth

Determine columns needed for a fixed-size wide-character string

----

wcwidth is a simple JavaScript port of [wcwidth](http://man7.org/linux/man-pages/man3/wcswidth.3.html) implemented in C by Markus Kuhn.

JavaScript port [originally](https://github.com/mycoboco/wcwidth.js) written by Woong Jun <woong.jun@gmail.com> (http://code.woong.org/)

## Example

```js
'한'.length    // => 1
wcwidth('한');   // => 2

'한글'.length    // => 2
wcwidth('한글'); // => 4
```

`wcwidth()` and its string version, `wcswidth()` are defined by IEEE Std
1002.1-2001, a.k.a. POSIX.1-2001, and return the number of columns used
to represent the given wide character and string.

Markus's implementation assumes the wide character given to those
functions to be encoded in ISO 10646, which is almost true for
JavaScript's characters.

[Further explaination here](docs)

## License

MIT

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