canFold
static
Boolean
canFold
(
string
)
true
if the specified string contains one or more
characters that can be folded, false
otherwise.
- Parameters:
-
string <String>
String to test.
compare
static
Boolean
compare
(
a
,
b
,
func
)
true
if they're the same, false
otherwise. If
a custom comparison function is supplied, the accent-folded strings will
be passed to that function for comparison.
- Parameters:
-
a <String>
First string to compare. -
b <String>
Second string to compare. -
func <Function>
(optional) Custom comparison function. Should return a truthy or falsy value.
- Returns:
Boolean
- Results of the comparison.
filter
static
Array
filter
(
haystack
,
func
)
Returns a copy of haystack containing only the strings for which
the supplied function returns true
.
While comparisons will be made using accent-folded strings, the returned array of matches will contain the original strings that were passed in.
- Parameters:
-
haystack <Array>
Array of strings to filter. -
func <Function>
Comparison function. Will receive an accent-folded haystack string as an argument, and should return a truthy or falsy value.
- Returns:
Array
- Filtered copy of haystack.
fold
static
String|Array
fold
(
input
)
- Parameters:
-
input <String|Array>
String or array of strings to be folded.
- Returns:
String|Array
- Folded string or array of strings.