0.1.0 • Published 9 years ago
ends-with-any v0.1.0
ends-with-any
Returns true if the given string or array ends with any of the given substrings.
Install
Install with npm
$ npm i ends-with-any --save
Usage
var endsWithAny = require('ends-with-any');
true
All of the following return true
:
endsWithAny('abc', 'c');
endsWithAny('xyz', 'z');
endsWithAny(['a', 'b', 'c'], 'c');
endsWithAny(['x', 'y', 'z'], 'z');
endsWithAny('abc', ['a', 'z', 'c']);
endsWithAny('xyz', ['x', 'y', 'z']);
endsWithAny('foo bar baz', ['slls', 'a', 'baz']);
endsWithAny(['a', 'b', 'c'], ['c', 'g', 'foo']);
endsWithAny(['x', 'y', 'z'], ['alpha', 'delta', 'z']);
//=> true
false
All of the following return false
:
endsWithAny('xyz', 'x');
endsWithAny('abc', 'a');
endsWithAny('abc', ['x', 'y', 'z']);
endsWithAny('xyz', ['a', 'b', 'c']);
endsWithAny('foo bar baz', ['slls', 'a', 'foo']);
//=> false
Related projects
- ends-with: Returns
true
if the givenstring
orarray
ends withsuffix
using strict equality for… more - starts-with: Returns
true
if the given string or array starts with prefix using strict equality for… more - starts-with-any: Returns true if the given string or array begins with any of the given substrings.
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on July 09, 2015.
0.1.0
9 years ago