Skip to content

Commit

Permalink
fix: arrayOr: check for undefined or null instead of !value (#1272)
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurin-W authored Jun 14, 2024
1 parent a7b922d commit 6b0410c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/frontend/packages/activitypub-components/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const arrayOf = value => {
// If the field is null-ish, we suppose there are no values.
if (!value) {
if (value === null || value === undefined) {
return [];
}
// Return as is.
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/packages/activitypub/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const delay = t => new Promise(resolve => setTimeout(resolve, t));

const arrayOf = value => {
// If the field is null-ish, we suppose there are no values.
if (!value) {
if (value === null || value === undefined) {
return [];
}
// Return as is.
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/packages/jsonld/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const mergeObjectInArray = (obj, arr) => {

const arrayOf = value => {
// If the field is null-ish, we suppose there are no values.
if (!value) {
if (value === null || value === undefined) {
return [];
}
// Return as is.
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/packages/ldp/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const parseJson = json => {

const arrayOf = value => {
// If the field is null-ish, we suppose there are no values.
if (!value) {
if (value === null || value === undefined) {
return [];
}
// Return as is.
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/packages/ontologies/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const arrayOf = value => {
// If the field is null-ish, we suppose there are no values.
if (!value) {
if (value === null || value === undefined) {
return [];
}
// Return as is.
Expand Down

0 comments on commit 6b0410c

Please sign in to comment.