1.0.0 • Published 6 years ago

@chenfengyuan/is-empty-string v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

is-empty-string

Build Status Coverage Status Downloads Version

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.
  • trim (optional)

    • Type: Boolean
    • Default: false
    • Indicates if remove whitespace from both ends of the value before length checking or not.
  • (return value)

    • Type: Boolean
    • Returns true if the given value is an empty string, else false.

Examples

import isEmptyString from '@chenfengyuan/is-empty-string';

isEmptyString('');
// > true

isEmptyString(' ');
// > false

isEmptyString(' ', true);
// > true

isEmptyString('foo');
// > false

isEmptyString(1);
// > false

License

MIT © Chen Fengyuan