-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61fdb07
commit b627ea5
Showing
7 changed files
with
40 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
* text=auto | ||
*.js text eol=lf | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
language: node_js | ||
node_js: | ||
- '10' | ||
- '8' | ||
- '6' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
Check if a path is in the [current working directory](https://en.wikipedia.org/wiki/Working_directory). | ||
@example | ||
``` | ||
import isPathInCwd = require('is-path-in-cwd'); | ||
isPathInCwd('unicorn'); | ||
//=> true | ||
isPathInCwd('../rainbow'); | ||
//=> false | ||
isPathInCwd('.'); | ||
//=> false | ||
``` | ||
*/ | ||
declare function isPathInCwd(path: string): boolean; | ||
|
||
export = isPathInCwd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
'use strict'; | ||
const isPathInside = require('is-path-inside'); | ||
|
||
module.exports = input => isPathInside(input, process.cwd()); | ||
module.exports = path => isPathInside(path, process.cwd()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import {expectType} from 'tsd'; | ||
import isPathInCwd = require('.'); | ||
|
||
expectType<boolean>(isPathInCwd('unicorn')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import test from 'ava'; | ||
import m from '.'; | ||
import isPathInCwd from '.'; | ||
|
||
test('main', t => { | ||
t.true(m('foo')); | ||
t.false(m('.')); | ||
t.false(m('/')); | ||
t.false(m('..')); | ||
t.false(m('../rainbow')); | ||
t.true(isPathInCwd('foo')); | ||
t.false(isPathInCwd('.')); | ||
t.false(isPathInCwd('/')); | ||
t.false(isPathInCwd('..')); | ||
t.false(isPathInCwd('../rainbow')); | ||
}); |