|
'use strict';
|
|
|
|
/**
|
|
* Helper to convert an array of objects to JSON
|
|
*/
|
|
module.exports = function arrayToJSON(arr) {
|
|
return arr.map(item => {
|
|
if (typeof item === 'object' && item !== null && typeof item.toJSON === 'function') {
|
|
return item.toJSON();
|
|
}
|
|
return item;
|
|
});
|
|
};
|