dist/fuzzy-match-utils.js
function cleanUpText(input, substitutions) {
    if (!input) {
        return '';
    }

    // Uppercase and remove all non-alphanumeric, non-accented characters.
    // Also remove underscores.
    input = input.toUpperCase().replace(/((?=[^\u00E0-\u00FC])\W)|_/g, '');

    if (!substitutions) {
        return input;
    }
    var safeSubstitutions = substitutions; // For Flow.

    // Replace all strings in `safeSubstitutions` with their standardized
    // counterparts.
    return Object.keys(safeSubstitutions).reduce(function (output, substitution) {
        var unsubbed = new RegExp(substitution, 'g');
        return output.replace(unsubbed, safeSubstitutions[substitution]);
    }, input);
}
function cleanUpText(input, substitutions) {
    if (!input) {
        return '';
    }

    // Uppercase and remove all non-alphanumeric, non-accented characters.
    // Also remove underscores.
    input = input.toUpperCase().replace(/((?=[^\u00E0-\u00FC])\W)|_/g, '');

    if (!substitutions) {
        return input;
    }
    var safeSubstitutions = substitutions; // For Flow.

    // Replace all strings in `safeSubstitutions` with their standardized
    // counterparts.
    return Object.keys(safeSubstitutions).reduce(function (output, substitution) {
        var unsubbed = new RegExp(substitution, 'g');
        return output.replace(unsubbed, safeSubstitutions[substitution]);
    }, input);
}
function cleanUpText ( input , substitutions ) { if ( ! input ) { return '' ; } // Uppercase and remove all non-alphanumeric, non-accented characters. // Also remove underscores. input = input . toUpperCase ( ) . replace ( / ((?=[^\u00E0-\u00FC])\W)|_ / g , '' ) ; if ( ! substitutions ) { return input ; } var safeSubstitutions = substitutions ; // For Flow. // Replace all strings in `safeSubstitutions` with their standardized // counterparts. return Object . keys ( safeSubstitutions ) . reduce ( function ( output , substitution ) { var unsubbed = new RegExp ( substitution , 'g' ) ; return output . replace ( unsubbed , safeSubstitutions [ substitution ] ) ; } , input ) ; }
Apply string substitutions, remove non-alphanumeric characters, and convert
all letters to uppercase.

eg. 'Scoil Bhríde Primary School' may become 'SCOILBHRIDEPRIMARYSCHOOL'.

@param  input  An unsanitized input string.
@param  substitutions  Strings with multiple spellings or variations that we
expect to match, for example accented characters or abbreviated
words.

@return The sanitized text.
Apply string substitutions remove non - alphanumeric characters and convert all letters to uppercase .