JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 458961
  • Score
    100M100P100Q168876F
  • License ISC

Wordwrap that doesn't split words unless the word length is greater that the line width.

Package Exports

  • smartwrap

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 (smartwrap) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

smartwrap

Textwrap for javascript/nodejs. Correctly handles wide characters (宽字符) and emojis (😃). Automatically breaks long words.

Usage:

var Smartwrap = require('smartwrap');
var exampleText1 = '宽字符';
console.log(Smartwrap(exampleText1,{
    length : 2
}));

Outputs:

宽
字
符

*Because these are wide characters and occupy 2 spaces, even though in javascript their string length is 1.