UNPKG

3.75 kBMarkdownView Raw
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
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
7Install with [npm](https://www.npmjs.com/):
8
9```sh
10$ npm install --save is-dotfile
11```
12
13## Usage
14
15To 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
18var isDotfile = require('is-dotfile');
19```
20
21**false**
22
23All of the following return `false`:
24
25```js
26isDotfile('a/b/c.js');
27isDotfile('/.git/foo');
28isDotfile('a/b/c/.git/foo');
29//=> false
30```
31
32**true**
33
34All of the following return `true`:
35
36```js
37isDotfile('a/b/.gitignore');
38isDotfile('.gitignore');
39isDotfile('/.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
54Pull 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
67To 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
75Running 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
90Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
91Released 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