Skip to content

Commit

Permalink
re-introduced fold(str, replacement) for backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mplatt committed May 14, 2019
1 parent c5e009e commit 66968b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/ascii-folder.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
* the License.
*/
class ASCIIFolder {

// maintain deprecated methods for backwards compatibility
// noinspection JSUnusedGlobalSymbols
static fold(str = '', replacement = '') {
return this.foldReplacing(str, replacement);
}

static foldReplacing(str = '', replacement = '') {
return this._fold(str, () => replacement);
}
Expand All @@ -29,7 +36,6 @@ class ASCIIFolder {
}

static _fold(str, fallback) {
// noinspection JSValidateTypes
if (str === null)
return '';

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fold-to-ascii",
"version": "4.1.1",
"version": "4.1.2",
"description": "A JavaScript port of the Apache Lucene ASCII Folding Filter that converts alphabetic, numeric, and symbolic Unicode characters which are not in the first 127 ASCII characters (the \"Basic Latin\" Unicode block) into a ASCII equivalents, if they exist.",
"main": "lib/ascii-folder.js",
"scripts": {
Expand Down

0 comments on commit 66968b7

Please sign in to comment.