Skip to content

Commit

Permalink
Fix filePath > filename
Browse files Browse the repository at this point in the history
Thanks to @blakeembrey for mentioning it.

Closes GH-1.
  • Loading branch information
wooorm committed Aug 26, 2015
1 parent 61579f7 commit c50e6b8
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "is-hidden",
"main": "is-hidden.js",
"description": "Check if `filePath` is hidden (starts with a dot)",
"description": "Check if `filename` is hidden (starts with a dot)",
"license": "MIT",
"keywords": [
"file",
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "is-hidden",
"version": "1.0.0",
"description": "Check if `filePath` is hidden (starts with a dot)",
"description": "Check if `filename` is hidden (starts with a dot)",
"license": "MIT",
"keywords": [
"file",
Expand Down
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
* @copyright 2014-2015 Titus Wormer
* @license MIT
* @module is-hidden
* @fileoverview Check if `filePath` is hidden (starts with a dot).
* @fileoverview Check if `filename` is hidden (starts with a dot).
*/

'use strict';

/* eslint-env commonjs */

/**
* Check if `filePath` is hidden (starts with a dot).
* Check if `filename` is hidden (starts with a dot).
*
* @param {string} filePath - File-path to check.
* @return {boolean} - Whether `filePath` is hidden.
* @throws {Error} - When `filePath` is not a string.
* @param {string} filename - File-path to check.
* @return {boolean} - Whether `filename` is hidden.
* @throws {Error} - When `filename` is not a string.
*/
function isHidden(filePath) {
if (typeof filePath !== 'string') {
function isHidden(filename) {
if (typeof filename !== 'string') {
throw new Error('Expected string');
}

return filePath.charAt(0) === '.';
return filename.charAt(0) === '.';
}

module.exports = isHidden;
16 changes: 8 additions & 8 deletions is-hidden.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
* @copyright 2014-2015 Titus Wormer
* @license MIT
* @module is-hidden
* @fileoverview Check if `filePath` is hidden (starts with a dot).
* @fileoverview Check if `filename` is hidden (starts with a dot).
*/

'use strict';

/* eslint-env commonjs */

/**
* Check if `filePath` is hidden (starts with a dot).
* Check if `filename` is hidden (starts with a dot).
*
* @param {string} filePath - File-path to check.
* @return {boolean} - Whether `filePath` is hidden.
* @throws {Error} - When `filePath` is not a string.
* @param {string} filename - File-path to check.
* @return {boolean} - Whether `filename` is hidden.
* @throws {Error} - When `filename` is not a string.
*/
function isHidden(filePath) {
if (typeof filePath !== 'string') {
function isHidden(filename) {
if (typeof filename !== 'string') {
throw new Error('Expected string');
}

return filePath.charAt(0) === '.';
return filename.charAt(0) === '.';
}

module.exports = isHidden;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "is-hidden",
"version": "1.0.0",
"description": "Check if `filePath` is hidden (starts with a dot)",
"description": "Check if `filename` is hidden (starts with a dot)",
"license": "MIT",
"keywords": [
"file",
Expand Down
12 changes: 6 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# is-hidden [![Build Status](https://img.shields.io/travis/wooorm/is-hidden.svg?style=flat)](https://travis-ci.org/wooorm/is-hidden) [![Coverage Status](https://img.shields.io/coveralls/wooorm/is-hidden.svg?style=flat)](https://coveralls.io/r/wooorm/is-hidden?branch=master)

Check whether `filePath` is hidden (starts with a dot).
Check whether `filename` is hidden (starts with a dot).

## Installation

Expand All @@ -26,21 +26,21 @@ isHidden('readme.md'); // false

## API

### isHidden(filePath)
### isHidden(filename)

Check whether `filePath` is hidden (starts with a dot).
Check whether `filename` is hidden (starts with a dot).

**Parameters**

* `filePath` (`string`) — File-path to check.
* `filename` (`string`) — File-path to check.

**Returns**

`boolean` — Whether `filePath` is hidden.
`boolean` — Whether `filename` is hidden.

**Throws**

* `Error` — When `filePath` is not a string.
* `Error` — When `filename` is not a string.

## License

Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var throws = assert.throws;
* Tests.
*/

describe('isHidden(filePath)', function () {
describe('isHidden(filename)', function () {
it('should work', function () {
equal(isHidden('.git'), true);
equal(isHidden('git'), false);
Expand Down

0 comments on commit c50e6b8

Please sign in to comment.