@leichtgewicht/visualwidth
unicode character visual width
Last updated 5 years ago by leichtgewicht .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @leichtgewicht/visualwidth 
SYNC missed versions from official npm registry.

VisualWidth

This is a unicode character's visual width calculator for javascript.

This module supports node.js, too.

SYNOPSIS

var vw = require('./visualwidth');
console.log(vw('あいうabc')); # => 9
console.log(vw.width('あいうabc')); # => 9
console.log(vw.truncate('ほう。hasegawaさん', 7, '...')); # => "ほう..."
console.log(vw.substr('あいうabc', 1, 4)); # => "いうab"
console.log(vw.substring('あいうabc', 2, 4)); # => "うa"
console.log(vw.indexOf('あいうabc', 'a')); # => 6
console.log(vw.lastIndexOf('あいうabc', 'a')); # => 6)

Current Tags

  • 0.1.0                                ...           latest (5 years ago)

1 Versions

  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |