mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
fix: add back marko v3 legacy helpers
This commit is contained in:
parent
75d0ab8301
commit
5b4ffa85d4
5
.changeset/sour-carrots-ring.md
Normal file
5
.changeset/sour-carrots-ring.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"marko": patch
|
||||
---
|
||||
|
||||
Add back the "legacy helpers" from Marko 3 to simplify the process of upgrading some older applications.
|
||||
3
packages/marko/helpers/README.md
Normal file
3
packages/marko/helpers/README.md
Normal 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.
|
||||
4
packages/marko/helpers/empty.js
Normal file
4
packages/marko/helpers/empty.js
Normal file
@ -0,0 +1,4 @@
|
||||
var notEmpty = require("./notEmpty");
|
||||
module.exports = function empty(o) {
|
||||
return !notEmpty(o);
|
||||
};
|
||||
11
packages/marko/helpers/notEmpty.js
Normal file
11
packages/marko/helpers/notEmpty.js
Normal 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;
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user