-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
054b623
commit 3ece912
Showing
4 changed files
with
54 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @file Type Tests - isSep | ||
* @module pathe/internal/tests/unit-d/isSep | ||
*/ | ||
|
||
import type { Sep } from '#src/types' | ||
import testSubject from '../is-sep' | ||
|
||
describe('unit-d:internal/isSep', () => { | ||
it('should guard Sep', () => { | ||
expectTypeOf(testSubject).guards.toEqualTypeOf<Sep>() | ||
}) | ||
}) |
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,17 @@ | ||
/** | ||
* @file Unit Tests - isSep | ||
* @module pathe/internal/tests/unit/isSep | ||
*/ | ||
|
||
import { posix, win32 } from 'node:path' | ||
import testSubject from '../is-sep' | ||
|
||
describe('unit:internal/isSep', () => { | ||
it('should return false if value is not path separator', () => { | ||
expect(testSubject(win32.sep)).to.be.false | ||
}) | ||
|
||
it('should return true if value is path separator', () => { | ||
expect(testSubject(posix.sep)).to.be.true | ||
}) | ||
}) |
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,21 @@ | ||
/** | ||
* @file Internal - isSep | ||
* @module pathe/internal/isSep | ||
*/ | ||
|
||
import sep from '#src/lib/sep' | ||
import type { Sep } from '#src/types' | ||
|
||
/** | ||
* Checks if `value` is a path separator. | ||
* | ||
* [1]: {@link ../lib/sep.ts} | ||
* | ||
* @see [`sep`][1] | ||
* | ||
* @param {unknown} value - Possible path separator | ||
* @return {value is Sep} `true` if `str` is path separator | ||
*/ | ||
const isSep = (value: unknown): value is Sep => value === sep | ||
|
||
export default isSep |
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