string-dashes
v1.2.13
Published
Comprehensive, HTML-entities-aware tool to typographically-correct the dashes and hyphens
Downloads
65
Maintainers
Readme
Install
This package is pure ESM.
npm i string-dashes
Quick Take
import { strict as assert } from "assert";
import { convertOne, convertAll } from "string-dashes";
assert.deepEqual(
convertAll("Dashes come in two sizes - the en dash and the em dash.", {
convertDashes: true,
convertEntities: true,
}),
{
result: "Dashes come in two sizes — the en dash and the em dash.",
ranges: [[25, 26, "—"]],
},
);
assert.deepEqual(
convertOne("Dashes come in two sizes - the en dash and the em dash.", {
from: 25,
convertDashes: true,
convertEntities: true,
}),
[[25, 26, "—"]],
);
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.