Compare two strings while ignoring 'A' or 'The' at the beginning
$ npm install --save compare-ignoring-articles
const compareIgnoringArticles = require('compare-ignoring-articles');
compareIgnoringArticles('The Title', 'Title');
//=> 0
Type: string
The first string to use.
Type: string
The second string to use.
Type: bool
Default: true
Whether or not the comparison should be case sensitive.
- Negative when the str1 occurs before str2
- Positive when the str1 occurs after str2
- Returns 0 if they are equivalent
Note that this is the same as String#localeCompare, which this library uses once articles have been stripped.
MIT © Matt Horn