strikethrough-js
Advanced tools
Comparing version 1.2.4 to 1.3.0
30
index.js
@@ -47,7 +47,17 @@ /** | ||
/** | ||
* Get strikethrough chars of a string | ||
* Get strikethrough string of a string | ||
* @param {String} str - The string | ||
* @returns {String} The price | ||
*/ | ||
function getStrikethroughString(str) { | ||
var arr = getStrikethroughChars(str); | ||
return arr.join(''); | ||
} | ||
/** | ||
* Get chars removing strikethrough of a string | ||
* @param {String} str - The string | ||
* @returns {Array} The price | ||
*/ | ||
function getRemoveStrikethroughChars(str) { | ||
function getChars(str) { | ||
const strikethroughChars = getStrikethroughChars(str); | ||
@@ -63,4 +73,14 @@ if (strikethroughChars.length > 0) { | ||
/** | ||
* Get strikethrough string of a string | ||
* @param {String} str - The string | ||
* @returns {String} The price | ||
*/ | ||
function getString(str) { | ||
var arr = getChars(str); | ||
return arr.join(''); | ||
} | ||
/** | ||
* Exports modules | ||
* @type {{removeStrikethroughChars: removeStrikethroughChars, removeStrikethrough: removeStrikethrough, getStrikethroughChars: getStrikethroughChars}} | ||
* @type {{removeStrikethroughChars: removeStrikethroughChars, removeStrikethrough: removeStrikethrough, getChars: getChars}} | ||
*/ | ||
@@ -71,4 +91,6 @@ module.exports = { | ||
getStrikethroughChars, | ||
getRemoveStrikethroughChars | ||
getStrikethroughString, | ||
getChars, | ||
getString | ||
}; | ||
{ | ||
"name": "strikethrough-js", | ||
"version": "1.2.4", | ||
"version": "1.3.0", | ||
"description": "Manipulate strikethrough chars in Javascript", | ||
@@ -25,4 +25,8 @@ "main": "index.js", | ||
"devDependencies": { | ||
"jest": "^23.6.0" | ||
} | ||
"jest": "^23.6.0", | ||
"pre-commit": "^1.2.2" | ||
}, | ||
"pre-commit": [ | ||
"test" | ||
] | ||
} |
@@ -19,10 +19,6 @@ # StrikethroughJS | ||
var lib = require('strikethrough-js'); | ||
lib.removeStrikethrough(...); | ||
// or | ||
import { | ||
removeStrikethrough, | ||
removeStrikethroughChars, | ||
getStrikethroughChars, | ||
getRemoveStrikethroughChars | ||
removeStrikethrough | ||
} from 'strikethrough-js'; | ||
@@ -52,8 +48,23 @@ ``` | ||
### Get remove strikethrough chars | ||
### Get strikethrough string | ||
```javascript | ||
var str = getRemoveStrikethroughChars('456€ (1̶2̶3̶7̶8̶9̶€̶)'); | ||
var str = getStrikethroughString('456€ (1̶2̶3̶7̶8̶9̶€̶)'); | ||
console.log(str); | ||
// 1̶2̶3̶7̶8̶9̶€̶ | ||
``` | ||
### Get chars | ||
```javascript | ||
var str = getChars('456€ (1̶2̶3̶7̶8̶9̶€̶)'); | ||
console.log(str); | ||
// ["1", "2", "3", "7", "8", "9", "€"] | ||
``` | ||
### Get string | ||
```javascript | ||
var str = getChars('456€ (1̶2̶3̶7̶8̶9̶€̶)'); | ||
console.log(str); | ||
// 123789€ | ||
``` | ||
## Testing | ||
@@ -63,2 +74,2 @@ ```npm | ||
``` | ||
Will use [Jest](https://jestjs.io/) test suites. | ||
Will use [Jest](https://jestjs.io/) test suites and [pre-commit](https://pre-commit.com/) hook. |
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
7213
9
122
73
2