Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strikethrough-js

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strikethrough-js

Manipulate strikethrough characters in Javascript

  • 2.2.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source
strikethrough-js

Manipulate plain text strikethrough chars in Javascript

npm version

Why?

This library aims to help you manipulate strikethrough characters in strings.

What is strikethrough text?

Strikethrough is represented by words with a horizontal line through their center. It implies that the text is wrong and was recently deleted or marked as such. Unlike the HTML's tag, strikethrough text will work when you copy-paste it in to another location. That’s because the strikethrough characters [...] are in plain text. - Saijo George

An example

It can be useful when some fonts don't support strikethrough text. Using this, you will be able to use "regular" text and then apply strikethrough another way (e.g., in CSS: text-decoration: line-through;).

Get started

Install

npm install strikethrough-js

Use

// Common
var lib = require('strikethrough-js');
var res = lib.removeStrikethrough('m̶y̶T̶e̶x̶t̶');

// ES5/6
import * as lib from 'strikethrough-js';
const res = lib.removeStrikethrough('m̶y̶T̶e̶x̶t̶');

Utils

removeStrikethrough

Remove the strikethrough characters from your string and replace them by regular ones:

const str = removeStrikethrough('1̶2̶3̶7̶8̶9̶€̶');
console.log(str);
// 123789€

removeStrikethroughChars

Remove the strikethrough characters from your string:

const str = removeStrikethroughChars('456€ 1̶2̶3̶7̶8̶9̶€̶');
console.log(str);
// 456€ 

getStrikethroughChars

Get a list of the strikethrough characters in your string:

const str = getStrikethroughChars('456€ (1̶2̶3̶7̶8̶9̶€̶)');
console.log(str);
// ["1̶", "2̶", "3̶", "7̶", "8̶", "9̶", "€̶"]

getStrikethroughString

Get the strikethrough characters in your string:

const str = getStrikethroughString('456€ (1̶2̶3̶7̶8̶9̶€̶)');
console.log(str);
// 1̶2̶3̶7̶8̶9̶€̶

getChars

Get a list of the strikethrough characters of your string, but regular ones:

const str = getChars('456€ (1̶2̶3̶7̶8̶9̶€̶)');
console.log(str);
// ["1", "2", "3", "7", "8", "9", "€"]

getChars

Get the strikethrough characters of your string, but regular ones:

const str = getString('456€ (1̶2̶3̶7̶8̶9̶€̶)');
console.log(str);
// 123789€

Contribute

Library

Since this lib is pretty light, there is no need for a sophisticated bundler (like Webpack or Rollup). The core lib is bundled with bare bones NodeJS and Babel.

Tests

npm t

Will run Jest test suites. It will be also triggered by Husky git hooks.

Keywords

FAQs

Package last updated on 17 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc