Manipulate plain text strikethrough chars in Javascript
Why?
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
This library allows you to get rid of this because some fonts doesn't support strikethrough. You will be able to apply strikethrough another way (e.g., in CSS: text-decoration: line-through;
)
Install
npm i strikethrough-js
Usage
var lib = require('strikethrough-js');
var res = lib.removeStrikethrough('...');
import * as lib from 'strikethrough-js';
const res = lib.removeStrikethrough('...');
Remove strikethrough
const str = removeStrikethrough('1̶2̶3̶7̶8̶9̶€̶');
console.log(str);
Remove strikethrough chars
const str = removeStrikethroughChars('456€ 1̶2̶3̶7̶8̶9̶€̶');
console.log(str);
Get strikethrough chars
const str = getStrikethroughChars('456€ (1̶2̶3̶7̶8̶9̶€̶)');
console.log(str);
Get strikethrough string
const str = getStrikethroughString('456€ (1̶2̶3̶7̶8̶9̶€̶)');
console.log(str);
Get chars
const str = getChars('456€ (1̶2̶3̶7̶8̶9̶€̶)');
console.log(str);
Get string
const str = getString('456€ (1̶2̶3̶7̶8̶9̶€̶)');
console.log(str);
Develop
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 use Jest test suites and pre-commit hook.