@tryghost/helpers 1.1.64 → 1.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/helpers.js +4 -4
- package/es/helpers.js +4 -4
- package/es/helpers.js.map +1 -1
- package/lib/utils/visibility.js +4 -4
- package/package.json +7 -7
- package/umd/helpers.min.js +1 -1
- package/umd/helpers.min.js.map +1 -1
package/cjs/helpers.js
CHANGED
|
@@ -3514,17 +3514,17 @@ const filter = (items, visibility, fn) => {
|
|
|
3514
3514
|
const returnByDefault = includes(visArray, defaultVisibility);
|
|
3515
3515
|
|
|
3516
3516
|
// We don't want to change the structure of what is returned
|
|
3517
|
-
return reduce(items, function (
|
|
3517
|
+
return reduce(items, function (accumulator, item, key) {
|
|
3518
3518
|
// If the item has visibility, check to see if it matches, else if there's no visibility check for a match with the default visibility
|
|
3519
3519
|
if (includes(visArray, 'all') || item.visibility && includes(visArray, item.visibility) || !item.visibility && returnByDefault) {
|
|
3520
3520
|
const newItem = fn ? fn(item) : item;
|
|
3521
3521
|
if (isArray$1(items)) {
|
|
3522
|
-
|
|
3522
|
+
accumulator.push(newItem);
|
|
3523
3523
|
} else {
|
|
3524
|
-
|
|
3524
|
+
accumulator[key] = newItem;
|
|
3525
3525
|
}
|
|
3526
3526
|
}
|
|
3527
|
-
return
|
|
3527
|
+
return accumulator;
|
|
3528
3528
|
}, memo);
|
|
3529
3529
|
};
|
|
3530
3530
|
|
package/es/helpers.js
CHANGED
|
@@ -3515,19 +3515,19 @@ var filter = function filter(items, visibility, fn) {
|
|
|
3515
3515
|
var defaultVisibility = 'public';
|
|
3516
3516
|
var returnByDefault = includes(visArray, defaultVisibility); // We don't want to change the structure of what is returned
|
|
3517
3517
|
|
|
3518
|
-
return reduce(items, function (
|
|
3518
|
+
return reduce(items, function (accumulator, item, key) {
|
|
3519
3519
|
// If the item has visibility, check to see if it matches, else if there's no visibility check for a match with the default visibility
|
|
3520
3520
|
if (includes(visArray, 'all') || item.visibility && includes(visArray, item.visibility) || !item.visibility && returnByDefault) {
|
|
3521
3521
|
var newItem = fn ? fn(item) : item;
|
|
3522
3522
|
|
|
3523
3523
|
if (isArray$1(items)) {
|
|
3524
|
-
|
|
3524
|
+
accumulator.push(newItem);
|
|
3525
3525
|
} else {
|
|
3526
|
-
|
|
3526
|
+
accumulator[key] = newItem;
|
|
3527
3527
|
}
|
|
3528
3528
|
}
|
|
3529
3529
|
|
|
3530
|
-
return
|
|
3530
|
+
return accumulator;
|
|
3531
3531
|
}, memo);
|
|
3532
3532
|
};
|
|
3533
3533
|
|