58c22b479fb016f7c976eafdea4b43783e4625da4e15d838b81f2d421804f18c2c8785ef00928f2262ebc22bce7a5f732a2224ac740eb902f2394e89ede98f 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # is-dotfile [![NPM version](https://img.shields.io/npm/v/is-dotfile.svg?style=flat)](https://www.npmjs.com/package/is-dotfile) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-dotfile.svg?style=flat)](https://npmjs.org/package/is-dotfile) [![NPM total downloads](https://img.shields.io/npm/dt/is-dotfile.svg?style=flat)](https://npmjs.org/package/is-dotfile) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-dotfile.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-dotfile)
  2. > Return true if a file path is (or has) a dotfile. Returns false if the path is a dot directory.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install --save is-dotfile
  7. ```
  8. ## Usage
  9. To be considered a dotfile, it must be the last filename in the path, like `.gitignore`. Otherwise it's a [dot directory](https://github.com/jonschlinkert/is-dotdir), like `.git/` and `.github/`.
  10. ```js
  11. var isDotfile = require('is-dotfile');
  12. ```
  13. **false**
  14. All of the following return `false`:
  15. ```js
  16. isDotfile('a/b/c.js');
  17. isDotfile('/.git/foo');
  18. isDotfile('a/b/c/.git/foo');
  19. //=> false
  20. ```
  21. **true**
  22. All of the following return `true`:
  23. ```js
  24. isDotfile('a/b/.gitignore');
  25. isDotfile('.gitignore');
  26. isDotfile('/.gitignore');
  27. //=> true
  28. ```
  29. ## About
  30. ### Related projects
  31. * [dotdir-regex](https://www.npmjs.com/package/dotdir-regex): Regex for matching dot-directories, like `.git/` | [homepage](https://github.com/regexps/dotdir-regex "Regex for matching dot-directories, like `.git/`")
  32. * [dotfile-regex](https://www.npmjs.com/package/dotfile-regex): Regular expresson for matching dotfiles. | [homepage](https://github.com/regexps/dotfile-regex "Regular expresson for matching dotfiles.")
  33. * [is-dotdir](https://www.npmjs.com/package/is-dotdir): Returns true if a path is a dot-directory. | [homepage](https://github.com/jonschlinkert/is-dotdir "Returns true if a path is a dot-directory.")
  34. * [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
  35. ### Contributing
  36. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  37. ### Contributors
  38. | **Commits** | **Contributor** |
  39. | --- | --- |
  40. | 13 | [jonschlinkert](https://github.com/jonschlinkert) |
  41. | 1 | [Lykathia](https://github.com/Lykathia) |
  42. ### Building docs
  43. _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
  44. To generate the readme, run the following command:
  45. ```sh
  46. $ npm install -g verbose/verb#dev verb-generate-readme && verb
  47. ```
  48. ### Running tests
  49. 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:
  50. ```sh
  51. $ npm install && npm test
  52. ```
  53. ### Author
  54. **Jon Schlinkert**
  55. * [github/jonschlinkert](https://github.com/jonschlinkert)
  56. * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
  57. ### License
  58. Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
  59. Released under the [MIT License](LICENSE).
  60. ***
  61. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 30, 2017._