JSPM

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

Comprehensive, HTML-entities-aware tool to typographically-correct the dashes and hyphens

Package Exports

  • string-dashes

Readme

string-dashes

Comprehensive, HTML-entities-aware tool to typographically-correct the dashes and hyphens

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence

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-2025 Roy Revelt and other contributors

ok codsen star