JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1820
  • Score
    100M100P100Q144435F
  • License MIT

Return `true` if a file path ends with the given string/suffix.

Package Exports

  • path-ends-with

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (path-ends-with) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

path-ends-with NPM version NPM monthly downloads Linux Build Status

Return true if a file path ends with the given string/suffix.

Install

Install with npm:

$ npm install --save path-ends-with

Install with yarn:

$ yarn add path-ends-with

Install with bower

$ bower install path-ends-with --save

Usage

var endsWith = require('path-ends-with');

endsWith('foo/bar', 'bar'); //=> true
endsWith('foo/bar', 'qux'); //=> false

// returns false for partial matches
endsWith('foobar', 'bar');  //=> false
endsWith('foo.bar', 'bar'); //=> false

Negation

Prefix with ! to invert matching behavior:

endsWith('foo/bar', '!bar'); //=> false
endsWith('foo/bar', '!qux'); //=> true

Options

options.nocase

Type: boolean

Default: false

Disable case sensitivity.

endsWith('foo/bar', 'BAR');                 //=> false
endsWith('foo/bar', 'BAR', {nocase: true}); //=> true

options.partialMatch

Type: boolean

Default: false

Allow "partial" matches:

endsWith('foobar', 'bar');                        //=> false                 
endsWith('foobar', 'bar', {partialMatch: true});  //=> true 

endsWith('foo.bar', 'bar');                       //=> false                 
endsWith('foo.bar', 'bar', {partialMatch: true}); //=> true 

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.5.0, on April 17, 2017.