JSPM

@homegrown/word-counter

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

word counter which support CJK and emoji

Package Exports

  • @homegrown/word-counter

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

Readme

This is a word count package which is support cjk and emoji

Getting started

npm install @homegrown/word-counter
const wordCounter = require("@homegrown/word-counter");

const text = "# 🙂 Hello, World.\n探索充满创新的世界。";

wordCounter.countWords(text); // count Words: 12
wordCounter.countLines(text); // count Lines: 2
wordCounter.countCharacters(text); // count characters without spaces: 24
wordCounter.countCharacters(text, true); // count characters with spaces: 27
wordCounter.count(text); // count all above items: {words: 12, lines: 2, characters: 24, charactersWithSpaces: 27}

Changelog

0.1.7

  • Fix include letter but except cjk letter, e.g. "Innodb的二级索引存储的值"

0.1.6

  • Update emoji regexp
  • Update word recognition