UNPKG
@sendgrid/helpers
Version:
beta (6.0.0-beta.5)
latest (8.0.0)
8.0.0
7.7.0
7.6.2
7.6.0
7.5.0
7.4.6
7.4.3
7.4.2
7.4.0
7.3.0
7.2.6
7.2.4
7.2.3
7.2.0
7.0.1
7.0.0
6.5.5
6.5.3
6.5.1
6.5.0
6.4.0
6.3.0
6.2.1
6.2.0
6.1.5
6.1.3
6.1.2
6.1.1
6.1.0
6.0.0
6.0.0-beta.5
6.0.0-beta.4
6.0.0-beta.3
6.0.0-beta.2
Twilio SendGrid NodeJS internal helpers
sendgrid.com
sendgrid/sendgrid-nodejs
@sendgrid/helpers
/
helpers
/
array-to-json.js
14 lines
(12 loc)
•
294 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'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; }); };