Skip to content

zboris12/kaigyo.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kaigyo.js

A little javascript module to make sentence of CJK characters more human-friendly by breaking line at appropriate position.

How to use

  1. Install

npm install kaigyo.js
  1. Import

// CommonJS module mode
const { breakLine } = require("kaigyo.js");

OR

//  ES module mode
import { breakLine } from "kaigyo.js";

Function Definitions

calcWidth

🫕🫕🫕
calcWidth(str) ➡️ number
Calculate the width of a string.
(1 for CJK characters, 0.5 for others)

Name Type Attributes Description
str string required The target string

breakLine

🫕🫕🫕
breakLine(str, cpl, lc, lf) ➡️ string
Insert break line to a string.

Name Type Attributes Description
str string required The target string
cpl number required Width per line
lc number required The count of lines
lf string optional The symbol of line break
Default is "\n"

License

This module is available under the MIT license.

About

A little javascript module to make sentence of CJK characters more human-friendly by breaking line at appropriate position.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published