MCPcopy
hub / github.com/imbrn/v8n / consideredEmpty

Function consideredEmpty

src/rules/optional.js:1–11  ·  view source on GitHub ↗
(value, considerTrimmedEmptyString)

Source from the content-addressed store, hash-verified

1const consideredEmpty = (value, considerTrimmedEmptyString) => {
2 if (
3 considerTrimmedEmptyString &&
4 typeof value === 'string' &&
5 value.trim().length === 0
6 ) {
7 return true;
8 }
9
10 return value === undefined || value === null;
11};
12
13export default (validation, considerTrimmedEmptyString = false) => ({
14 simple: value =>

Callers 1

optional.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected