JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q10888F
  • License MIT

Chop a large text to array

Package Exports

  • text-chopper

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

Readme

text-chopper

Divide a long text to small chunks. The text is divided at just the end of line. The byte length of each chunks are smaller than a size specified by chunkSize of parameter options.

This is available on both of browser and node.js

USAGE

Import this module by the CommonJS way.

const TextChopper = require("text-chopper");

const text = [
    "ABCDEFG",
    "HIJKLMN",
    "OPQRSTU",
].join("\r\n");

const chunks = TextChopper.chop(
    text, {chunkSize: 10});

// chunks[0] == "ABCDEFG\r\n"
// chunks[1] == "HIJKLMN\r\n"
// chunks[2] == "OPQRSTU\r\n"

INSTALLATION

Use npm to install.

$ npm install --save text-chopper