Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

string-apostrophes

codsen3.1kMIT4.0.19TypeScript support: included

Comprehensive, HTML-entities-aware tool to typographically-correct the apostrophes and single/double quotes

apostrophe, apostrophes, convert, correct, fix, string, typographical, typographically, typography

readme

string-apostrophes

Comprehensive, HTML-entities-aware tool to typographically-correct the apostrophes and single/double quotes

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

Install

This package is pure ESM. If you're not ready yet, install an older version of this program, 1.5.0 (npm i string-apostrophes@1.5.0).

npm i string-apostrophes

Quick Take

import { strict as assert } from "assert";

import { convertOne, convertAll } from "string-apostrophes";

assert.deepEqual(
  convertAll("In the '60s, rock 'n' roll", {
    convertApostrophes: true,
    convertEntities: false,
  }),
  {
    result: "In the ’60s, rock ’n’ roll",
    ranges: [
      [7, 8, "’"],
      [18, 21, "’n’"],
    ],
  },
);

assert.deepEqual(
  convertOne("test's", {
    from: 4,
    to: 5,
    convertApostrophes: true,
    convertEntities: true,
  }),
  [[4, 5, "’"]],
);

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.

ok codsen star

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

4.0.0 (2022-12-01)

BREAKING CHANGES

  • Minimum supported Node version is v14.18; we're dropping v12 support

3.1.0 (2022-08-12)

Features

3.0.0 (2022-04-28)

Fixed

BREAKING CHANGES

  • now convertOne() option opts.convertEntities default is false (it was wrongly true before)

2.1.0 (2022-04-11)

Features

  • export defaults and version (1107244)

2.0.0 (2021-09-09)

Features

BREAKING CHANGES

  • programs now are in ES Modules and won't work with Common JS require()

1.5.0 (2021-05-24)

Features

  • config file based major bump blacklisting (e15f9bb)

1.4.15 (2021-04-11)

Reverts

  • Revert "chore: setup refresh" (23cf206)

1.4.1 (2021-01-28)

Fixed

  • add testStats to npmignore (f3c84e9)

1.4.0 (2021-01-23)

Features

1.2.0 (2019-10-02)

Features

  • don't convert single apostrophe or double apostrophe if there's nothing around it (5d940b3)
  • explicit settings which decode if options are off (4f1117a)

1.1.0 (2019-09-11)

Features

1.0.0 (2019-09-06)

  • First public release