Skip to content

peabnuts123/is-nonempty-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

is-nonempty-string

Module to test whether an object is a string that contains one or more non-whitespace characters.

Will return false in any case where input is not a string, or contains only whitespace characters, including spaces, tabs, non-breaking spaces, or newline characters.

Installation

Installation is easiest through npm:

npm install is-nonempty-string --save

Usage

is-nonempty-string can be easily included and used in two ways, depending on how you would like to use it.

Firstly, directly, as a reference:

var isNonEmptyString = require('is-nonempty-string')();

function isUserInputDefined(userInput) {
    return isNonEmptyString(userInput);
}

or as a decorator on String.prototype:

require('is-nonempty-string')({ mode: 'prototype'});


function isUserInputDefined(userString) {
    return userString.isNonEmpty();
}   

Full list of options

var direct = require('is-nonempty-string')(options)

Call to the is-nonempty-string module function only returns a value if direct is specified as true

Only 2 options are supported at this point:

  • direct : true/false,
  • prototype : true/false

At least one of direct or prototype must be defined

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published