mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Make notEmpty more robust
This commit is contained in:
parent
452a695e20
commit
13fb3b8b78
@ -9,10 +9,15 @@ var markoRegExp = /\.marko(.xml)?$/;
|
||||
var req = require;
|
||||
|
||||
function notEmpty(o) {
|
||||
if (Array.isArray(o) === true) {
|
||||
return o.length !== 0;
|
||||
if (o == null) {
|
||||
return false;
|
||||
} else if (Array.isArray(o)) {
|
||||
return !!o.length;
|
||||
} else if (o === '') {
|
||||
return false;
|
||||
}
|
||||
return o;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user