@chenfengyuan/is-empty-string
v1.0.0
Published
Check if the given value is an empty string.
Downloads
5
Readme
is-empty-string
Check if the given value is an empty string.
Main
dist/
├── is-empty-string.js (UMD)
├── is-empty-string.min.js (UMD, compressed)
├── is-empty-string.common.js (CommonJS, default)
└── is-empty-string.esm.js (ES Module)
Install
npm install @chenfengyuan/is-empty-string
Usage
Syntax
isEmptyString(value, trim = false);
value
- Type:
*
- The value to check.
- Type:
trim (optional)
- Type:
Boolean
- Default:
false
- Indicates if remove whitespace from both ends of the value before length checking or not.
- Type:
(return value)
- Type:
Boolean
- Returns
true
if the given value is an empty string, elsefalse
.
- Type:
Examples
import isEmptyString from '@chenfengyuan/is-empty-string';
isEmptyString('');
// > true
isEmptyString(' ');
// > false
isEmptyString(' ', true);
// > true
isEmptyString('foo');
// > false
isEmptyString(1);
// > false