fix: add back marko v3 legacy helpers

This commit is contained in:
dpiercey 2024-10-09 13:20:20 -07:00 committed by Dylan Piercey
parent 75d0ab8301
commit 5b4ffa85d4
4 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
"marko": patch
---
Add back the "legacy helpers" from Marko 3 to simplify the process of upgrading some older applications.

View File

@ -0,0 +1,3 @@
# Marko Helpers
This directory contains helpers that were deprecated in Marko v3. Marko v4/5 no longer adds these helpers to every compiled template, but you can still import them if needed.

View File

@ -0,0 +1,4 @@
var notEmpty = require("./notEmpty");
module.exports = function empty(o) {
return !notEmpty(o);
};

View File

@ -0,0 +1,11 @@
module.exports = function (o) {
if (o == null) {
return false;
} else if (Array.isArray(o)) {
return !!o.length;
} else if (o === "") {
return false;
}
return true;
};