UNPKG

ends-with-string

Version:

Check if a string or buffer ends with a given string

78 lines (52 loc) 2.4 kB
<!--BEGIN HEADER--> <div id="top" align="center"> <h1>ends-with-string</h1> <a href="https://npmjs.com/package/ends-with-string"> <img alt="NPM" src="https://img.shields.io/npm/v/ends-with-string.svg"> </a> <a href="https://github.com/bconnorwhite/ends-with-string"> <img alt="TypeScript" src="https://img.shields.io/github/languages/top/bconnorwhite/ends-with-string.svg"> </a> <a href="https://coveralls.io/github/bconnorwhite/ends-with-string?branch=master"> <img alt="Coverage Status" src="https://img.shields.io/coveralls/github/bconnorwhite/ends-with-string.svg?branch=master"> </a> </div> <br /> <blockquote align="center">Check if a string or buffer ends with a given string.</blockquote> <br /> _If I should maintain this repo, please ⭐️_ <a href="https://github.com/bconnorwhite/ends-with-string"> <img align="right" alt="GitHub stars" src="https://img.shields.io/github/stars/bconnorwhite/ends-with-string?label=%E2%AD%90%EF%B8%8F&style=social"> </a> _DM me on [Twitter](https://twitter.com/bconnorwhite) if you have questions or suggestions._ <a href="https://twitter.com/bconnorwhite"> <img align="right" alt="Twitter" src="https://img.shields.io/twitter/url?label=%40bconnorwhite&style=social&url=https%3A%2F%2Ftwitter.com%2Fbconnorwhite"> </a> --- <!--END HEADER--> ## Installation ```sh yarn add ends-with-string ``` ```sh npm install ends-with-string ``` ```sh pnpm add ends-with-string ``` ## API ```ts import endsWith from "ends-with-string"; function endsWith(input: string | Buffer, string: string): boolean; ``` <!--BEGIN FOOTER--> <br /> <h2 id="dependencies">Dependencies<a href="https://www.npmjs.com/package/ends-with-string?activeTab=dependencies"><img align="right" alt="dependencies" src="https://img.shields.io/librariesio/release/npm/ends-with-string.svg"></a></h2> - [char-to-string](https://www.npmjs.com/package/char-to-string): Convert a character or character code to string <br /> <h3>Dev Dependencies</h3> - [autorepo](https://www.npmjs.com/package/autorepo): Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts. <br /> <h2 id="license">License <a href="https://opensource.org/licenses/MIT"><img align="right" alt="license" src="https://img.shields.io/npm/l/ends-with-string.svg"></a></h2> [MIT](https://opensource.org/licenses/MIT) <!--END FOOTER-->