Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peabnuts123/is-nonempty-string
https://github.com/peabnuts123/is-nonempty-string
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/peabnuts123/is-nonempty-string
- Owner: peabnuts123
- License: isc
- Created: 2016-04-04T07:44:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-04T11:29:47.000Z (over 8 years ago)
- Last Synced: 2024-10-12T05:55:18.378Z (27 days ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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*