Package Exports
- cut-string
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cut-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
cut-string
Cut a string if too long. Support CJK and emoji❤️.
Install
$ npm install cut-string
Usage
const cutString = require('cut-string')
cutString('ABCDEFG', 4)
//=> 'ABCD'
cutString('我在东北玩泥巴', 4)
//=> '我在'
cutString('👨👩👧😀❣️😸', 6)
//=> '👨👩👧😀❣️'
cutString('我在东北玩泥巴', 6, { ellipsis: true })
//=> '我在...'
cutString('👨👩👧😀❣️😸', 6, { emojiWidth: 3 })
//=> '👨👩👧😀'