1.3.0 • Published 8 years ago

compare-ignoring-articles v1.3.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

compare-ignoring-articles Build Status

Compare two strings while ignoring 'A' or 'The' at the beginning

Install

$ npm install --save compare-ignoring-articles

Usage

const compareIgnoringArticles = require('compare-ignoring-articles');

compareIgnoringArticles('The Title', 'Title');
//=> 0

API

compareIgnoringArticles(str1, str2, caseSensitive)

str1

Type: string

The first string to use.

str2

Type: string

The second string to use.

caseSensitive

Type: bool Default: true

Whether or not the comparison should be case sensitive.

Return

  • 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.

License

MIT © Matt Horn

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago