strikethrough-js
Advanced tools
Comparing version 1.0.0 to 1.1.0
26
index.js
@@ -18,6 +18,6 @@ /** | ||
*/ | ||
module.exports = function removeStrikethroughChars(str) { | ||
function removeStrikethroughChars(str) { | ||
if (str && typeof str === 'string') return str.replace(regexStrikethroughChars, ''); | ||
return str | ||
}; | ||
} | ||
@@ -29,6 +29,6 @@ /** | ||
*/ | ||
module.exports = function removeStrikethrough(str) { | ||
function removeStrikethrough(str) { | ||
if (str && typeof str === 'string') return str.replace(regexStrikethrough, ''); | ||
return str | ||
}; | ||
} | ||
@@ -40,5 +40,19 @@ /** | ||
*/ | ||
module.exports = function getStrikethroughChars(str) { | ||
if (str && typeof str === 'string') return str.match(regexStrikethroughChars); | ||
function getStrikethroughChars(str) { | ||
if (str && typeof str === 'string') { | ||
var result = str.match(regexStrikethroughChars); | ||
return result ? result : []; | ||
} | ||
return [] | ||
} | ||
/** | ||
* Exports modules | ||
* @type {{removeStrikethroughChars: removeStrikethroughChars, removeStrikethrough: removeStrikethrough, getStrikethroughChars: getStrikethroughChars}} | ||
*/ | ||
module.exports = { | ||
removeStrikethroughChars, | ||
removeStrikethrough, | ||
getStrikethroughChars | ||
}; | ||
{ | ||
"name": "strikethrough-js", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Manipulate strikethrough chars in Javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,31 @@ | ||
# strikethrough-js | ||
# StrikethroughJS | ||
Manipulate strikethrough chars in Javascript | ||
[![npm version](https://badge.fury.io/js/strikethrough-js.svg)](https://badge.fury.io/js/strikethrough-js) | ||
## Install | ||
```npm | ||
npm install @ntltd/strikethrough-js | ||
``` | ||
## Usage | ||
### Remove strikethrough | ||
```javascript | ||
var str = removeStrikethrough('1̶2̶3̶7̶8̶9̶€̶'); | ||
console.log(str); | ||
// 123789€ | ||
``` | ||
### Remove strikethrough chars | ||
```javascript | ||
var str = removeStrikethroughChars('456€ 1̶2̶3̶7̶8̶9̶€̶'); | ||
console.log(str); | ||
// 456€ | ||
``` | ||
### Get strikethrough chars | ||
```javascript | ||
var str = getStrikethroughChars('456€ (1̶2̶3̶7̶8̶9̶€̶)'); | ||
console.log(str); | ||
// ["1̶", "2̶", "3̶", "7̶", "8̶", "9̶", "€̶"] | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3942
6
68
32