-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Evyatar <code@ealush.com>
- Loading branch information
1 parent
0bcf915
commit 5adc337
Showing
4 changed files
with
59 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { isBlank, isNotBlank } from 'isBlank'; | ||
|
||
describe('isBlank', () => { | ||
it('Should return true for a string of whitespaces', () => { | ||
expect(isBlank(' ')).toBe(true); | ||
}); | ||
|
||
it('Should return false for a string with at least a non-whitespace', () => { | ||
expect(isBlank('not blank')).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('isNotBlank', () => { | ||
it('Should return false for a string of whitespaces', () => { | ||
expect(isNotBlank(' ')).toBe(false); | ||
}); | ||
|
||
it('Should return true for a string with at least a non-whitespace', () => { | ||
expect(isNotBlank('not blank')).toBe(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,7 @@ | ||
import bindNot from 'bindNot'; | ||
|
||
export function isBlank(value) { | ||
return typeof value === 'string' && value.trim() === ''; | ||
} | ||
|
||
export const isNotBlank = bindNot(isBlank); |