import { splitLength } from "https://deno.land/x/enzastdlib@v0.0.4/strings/splitlength.ts";
Splits a string into lines delimited by a max character length.
Examples
Example 1
Example 1
import { assertEquals } from 'https://deno.land/std/testing/asserts.ts';
import { splitLength } from 'https://deno.land/x/enzastdlib/strings/mod.ts';
// **NOTE**: Taken from `deno lint --help`.
const text =
'The configuration file can be used to configure different aspects of deno including TypeScript, linting, and code formatting. Typically the configuration file will be called `deno.json` or `deno.jsonc` and automatically detected; in that case this flag is not necessary.\nSee https://deno.land/manual@v1.33.0/getting_started/configuration_file';
assertEquals(
splitLength(text, 66),
[
'The configuration file can be used to configure different aspects of',
'deno including TypeScript, linting, and code formatting. Typically',
'the configuration file will be called `deno.json` or `deno.jsonc` and',
'automatically detected; in that case this flag is not necessary.',
'See https://deno.land/manual@v1.33.0/getting_started/configuration_file',
];
);