2.0.18 • Published 1 year ago
string-truncator v2.0.18
Install
This package is pure ESM.
npm i string-truncator
Quick Take
import { strict as assert } from "assert";
import { truncate } from "string-truncator";
// maxLen setting means limit length to equivalent of 10
// longest letter lengths (font "Outfit" letter lengths are used)
// and you can override those references with your font-specific lengths
assert.deepEqual(truncate("Supermotodelicious", { maxLen: 10 }), {
result: "Supermotodelic",
addEllipsis: true,
});
assert.deepEqual(
truncate(
"the quick brown fox jumps over the lazy dog and then bites him in the tail and runs away",
{
maxLen: 10,
maxLines: 2,
},
),
{
result: "the quick brown fox jumps over",
addEllipsis: true,
},
);
Documentation
Please visit codsen.com for a full description of the API.
Contributing
To report bugs or request features or assistance, raise an issue on GitHub.
Licence
MIT License.
Copyright © 2010-2024 Roy Revelt and other contributors.
2.0.18
1 year ago
2.0.17
1 year ago
2.0.16
1 year ago
2.0.15
2 years ago
2.0.13
2 years ago
2.0.14
2 years ago
2.0.11
2 years ago
2.0.7
2 years ago
2.0.12
2 years ago
2.0.9
2 years ago
2.0.10
2 years ago
2.0.8
2 years ago
1.1.7
3 years ago
1.1.6
3 years ago
1.1.5
3 years ago
1.1.4
3 years ago
1.1.3
3 years ago
2.0.3
2 years ago
2.0.2
3 years ago
2.0.5
2 years ago
2.0.4
2 years ago
2.0.6
2 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.1.2
3 years ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago