unicode-accentfold-debug.js revision 282d643789e547528a735f5eccbdbf66fa38e981
/**
* Unicode utilities.
*
* @module unicode
* @since 3.3.0
*/
/**
* <p>
* Provides a basic Unicode accent folding implementation that converts common
* accented letters (like "รก") to their non-accented forms (like "a").
* </p>
*
* <p>
* This implementation is not comprehensive, and should only be used as a last
* resort when accent folding can't be done on the server. A comprehensive
* accent folding implementation would require much more character data to be
* sent to the browser, resulting in a significant performance penalty. This
* implementation strives for a compromise between usefulness and performance.
* </p>
*
* <p>
* Accent folding is a destructive operation that can't be reversed, and may
* change or destroy the actual meaning of the text depending on the language.
* It should not be used on strings that will later be displayed to a user,
* unless this is done with the understanding that linguistic meaning may be
* lost and that you may in fact confuse or insult the user by doing so.
* </p>
*
* @module unicode
* @submodule unicode-accentfold
* @class Unicode.AccentFold
* @static
*/
var YArray = Y.Array,
AccentFold = {
// -- Public Static Methods ------------------------------------------------
/**
* Returns <code>true</code> if the specified string contains one or more
* characters that can be folded, <code>false</code> otherwise.
*
* @method canFold
* @param {String} string String to test.
* @return {Boolean}
* @static
*/
var letter;
return true;
}
}
return false;
},
/**
* Compares the accent-folded versions of two strings and returns
* <code>true</code> if they're the same, <code>false</code> otherwise. If
* a custom comparison function is supplied, the accent-folded strings will
* be passed to that function for comparison.
*
* @method compare
* @param {String} a First string to compare.
* @param {String} b Second string to compare.
* @param {Function} func (optional) Custom comparison function. Should
* return a truthy or falsy value.
* @return {Boolean} Results of the comparison.
* @static
*/
},
/**
* <p>
* Returns a copy of <em>haystack</em> containing only the strings for which
* the supplied function returns <code>true</code>.
* </p>
*
* <p>
* While comparisons will be made using accent-folded strings, the returned
* array of matches will contain the original strings that were passed in.
* </p>
*
* @method filter
* @param {Array} haystack Array of strings to filter.
* @param {Function} func Comparison function. Will receive an accent-folded
* haystack string as an argument, and should return a truthy or falsy
* value.
* @return {Array} Filtered copy of <em>haystack</em>.
* @static
*/
});
},
/**
* Accent-folds the specified string or array of strings and returns a copy
* in which common accented letters have been converted to their closest
* non-accented, lowercase forms.
*
* @method fold
* @param {String|Array} input String or array of strings to be folded.
* @return {String|Array} Folded string or array of strings.
* @static
*/
}
});
return input;
}
};