包详细信息

string-remove-duplicate-heads-tails

codsen3.8kMIT7.0.22

Detect and (recursively) remove head and tail wrappings around the input string

alt, attributes, characters, dash

自述文件

string-remove-duplicate-heads-tails

Detect and (recursively) remove head and tail wrappings around the input string

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, 5.1.0 (npm i string-remove-duplicate-heads-tails@5.1.0).

npm i string-remove-duplicate-heads-tails

Quick Take

import { strict as assert } from "assert";

import { remDup } from "string-remove-duplicate-heads-tails";

assert.equal(
  remDup("{{ Hi {{ first_name }}! }}", {
    heads: "{{ ",
    tails: " }}",
  }),
  "Hi {{ first_name }}!",
);

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

更新日志

Change Log

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

7.0.0 (2022-12-01)

BREAKING CHANGES

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

6.1.0 (2022-08-12)

Features

6.0.16 (2022-04-18)

Fixed

6.0.0 (2021-09-09)

Features

BREAKING CHANGES

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

5.1.0 (2021-05-24)

Features

  • config file based major bump blacklisting (e15f9bb)

5.0.15 (2021-04-11)

Reverts

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

5.0.1 (2021-01-28)

Fixed

  • add testStats to npmignore (f3c84e9)

5.0.0 (2021-01-23)

Features

  • rewrite in TS, start using named exports (bcdd142)

BREAKING CHANGES

  • previously: import remDup from ... - now import { remDup } from ...

3.0.37 (2019-10-02)

Performance Improvements

  • remove options checking (check-types-mini) to make operations 4 times faster (1beffd4)

2.11.0 (2019-01-20)

  • Various documentation and setup tweaks after we migrated to monorepo
  • Setup refresh: updated dependencies and all config files using automated tools

2.9.0 (2018-12-26)

  • Relax the API and switch to Prettier (8aa4018)

2.8.0 (2018-10-26)

  • Updated all dependencies
  • Restored coveralls.io reporting
  • Restored unit test linting

2.7.0 (2018-06-26)

2.6.0 (2018-06-20)

2.5.0 (2018-06-11)

GitHub sold us out. In the meantime, we:

  • Migrated to BitBucket (to host repo + perform CI) and Codacy (for code quality audit)
  • Dropped BitHound (RIP) and Travis
  • Removed package-lock

2.4.0 (2018-05-16)

  • Tapped dependency string-match-left-right with its new {relaxedApi: true} option. This prevents throw errors in some edge case scenarios.

2.3.0 (2018-05-15)

  • Set up Prettier
  • Removed package.lock and .editorconfig
  • Wired Rollup to remove comments from non-dev builds. This means we can now leave the console.logs in the source code — Rollup will remove from production code.
  • Unit tests are pointing at ES modules build, which means that code coverage is correct now, without Babel functions being missed

2.2.0 (2018-03-27)

  • Relaxed the API - if the input is non-string, it's just returned back.
  • Switched from raw ESLint on airbnb-base preset to raw ESLint and Prettier.

2.1.0 (2018-02-14)

  • Trimming now touches only spaces. Line breaks, tabs and non-breaking spaces are not touched.

2.0.0 (2018-02-13)

  • Rewrote the whole thing. Added more unit tests.

1.0.0 (2018-01-11)

  • First public release