Skip to content

Commit

Permalink
patch: shorten isBlank
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Nov 10, 2021
1 parent 2534cf6 commit dc99d94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/n4s/src/rules/__tests__/isBlank.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isBlank, isNotBlank } from 'isBlank';

describe('isBlank', () => {
it('Should return true for a string of whitespaces', () => {
it('Should return true for a string of white spaces', () => {
expect(isBlank(' ')).toBe(true);
});

Expand All @@ -11,7 +11,7 @@ describe('isBlank', () => {
});

describe('isNotBlank', () => {
it('Should return false for a string of whitespaces', () => {
it('Should return false for a string of white spaces', () => {
expect(isNotBlank(' ')).toBe(false);
});

Expand Down
3 changes: 2 additions & 1 deletion packages/n4s/src/rules/isBlank.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import bindNot from 'bindNot';
import { isStringValue } from 'isStringValue';

export function isBlank(value: unknown): boolean {
return typeof value === 'string' && value.trim() === '';
return isStringValue(value) && !value.trim();
}

export const isNotBlank = bindNot(isBlank);

0 comments on commit dc99d94

Please sign in to comment.