You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
524 B
17 lines
524 B
import assertString from './util/assertString'; |
|
import toString from './util/toString'; |
|
import merge from './util/merge'; |
|
var defaulContainsOptions = { |
|
ignoreCase: false, |
|
minOccurrences: 1 |
|
}; |
|
export default function contains(str, elem, options) { |
|
assertString(str); |
|
options = merge(options, defaulContainsOptions); |
|
|
|
if (options.ignoreCase) { |
|
return str.toLowerCase().split(toString(elem).toLowerCase()).length > options.minOccurrences; |
|
} |
|
|
|
return str.split(toString(elem)).length > options.minOccurrences; |
|
} |