filename-ends-with

Check if filename ends with a specific string.

Usage no npm install needed!

<script type="module">
  import filenameEndsWith from 'https://cdn.skypack.dev/filename-ends-with';
</script>

README

filename-ends-with

Check if filename ends with specific string.

Installation

$ npm install filename-ends-with --save

Usage


import fEndsWith from 'filename-ends-with';

fEndsWith('somefilename.jpg', '.jpg');
// => true

fEndsWith('somefilename.jpeg', '.jpg');
// => false

fEndsWith('somefilename.txt', ['.md', '.json', '.txt']);
// => true

Tests

$ npm test

License

MIT