UNPKG

@sendgrid/helpers

Version:

Twilio SendGrid NodeJS internal helpers

14 lines (12 loc) 294 B
'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; }); };