isEmpty.js 346 B

12345678910
  1. import assertString from './util/assertString';
  2. import merge from './util/merge';
  3. var default_is_empty_options = {
  4. ignore_whitespace: false
  5. };
  6. export default function isEmpty(str, options) {
  7. assertString(str);
  8. options = merge(options, default_is_empty_options);
  9. return (options.ignore_whitespace ? str.trim().length : str.length) === 0;
  10. }