1 | # is-dotfile [](https://www.npmjs.com/package/is-dotfile) [](https://npmjs.org/package/is-dotfile) [](https://npmjs.org/package/is-dotfile) [](https://travis-ci.org/jonschlinkert/is-dotfile)
|
2 |
|
3 | > Return true if a file path is (or has) a dotfile. Returns false if the path is a dot directory.
|
4 |
|
5 | ## Install
|
6 |
|
7 | Install with [npm](https://www.npmjs.com/):
|
8 |
|
9 | ```sh
|
10 | $ npm install --save is-dotfile
|
11 | ```
|
12 |
|
13 | ## Usage
|
14 |
|
15 | 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/`.
|
16 |
|
17 | ```js
|
18 | var isDotfile = require('is-dotfile');
|
19 | ```
|
20 |
|
21 | **false**
|
22 |
|
23 | All of the following return `false`:
|
24 |
|
25 | ```js
|
26 | isDotfile('a/b/c.js');
|
27 | isDotfile('/.git/foo');
|
28 | isDotfile('a/b/c/.git/foo');
|
29 | //=> false
|
30 | ```
|
31 |
|
32 | **true**
|
33 |
|
34 | All of the following return `true`:
|
35 |
|
36 | ```js
|
37 | isDotfile('a/b/.gitignore');
|
38 | isDotfile('.gitignore');
|
39 | isDotfile('/.gitignore');
|
40 | //=> true
|
41 | ```
|
42 |
|
43 | ## About
|
44 |
|
45 | ### Related projects
|
46 |
|
47 | * [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/`")
|
48 | * [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.")
|
49 | * [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.")
|
50 | * [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")
|
51 |
|
52 | ### Contributing
|
53 |
|
54 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
55 |
|
56 | ### Contributors
|
57 |
|
58 | | **Commits** | **Contributor** |
|
59 | | --- | --- |
|
60 | | 13 | [jonschlinkert](https://github.com/jonschlinkert) |
|
61 | | 1 | [Lykathia](https://github.com/Lykathia) |
|
62 |
|
63 | ### Building docs
|
64 |
|
65 | _(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.)_
|
66 |
|
67 | To generate the readme, run the following command:
|
68 |
|
69 | ```sh
|
70 | $ npm install -g verbose/verb#dev verb-generate-readme && verb
|
71 | ```
|
72 |
|
73 | ### Running tests
|
74 |
|
75 | 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:
|
76 |
|
77 | ```sh
|
78 | $ npm install && npm test
|
79 | ```
|
80 |
|
81 | ### Author
|
82 |
|
83 | **Jon Schlinkert**
|
84 |
|
85 | * [github/jonschlinkert](https://github.com/jonschlinkert)
|
86 | * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
87 |
|
88 | ### License
|
89 |
|
90 | Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
91 | Released under the [MIT License](LICENSE).
|
92 |
|
93 | ***
|
94 |
|
95 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 30, 2017._ |
\ | No newline at end of file |