Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sendgrid/helpers

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sendgrid/helpers - npm Package Compare versions

Comparing version 6.0.0-beta.5 to 6.0.0

2

classes/personalization.js

@@ -251,3 +251,3 @@ 'use strict';

if (typeof substitutions !== 'object') {
throw new Error('Object expected for `substitutions`');
throw new Error('Object expected for `substitutions` in reverseMergeSubstitutions');
}

@@ -254,0 +254,0 @@ this.substitutions = Object.assign({}, substitutions, this.substitutions);

@@ -412,3 +412,3 @@ 'use strict';

expect(function() {
p.setSubstitutions(null);
p.setSubstitutions(3);
}).to.throw(Error);

@@ -484,5 +484,2 @@ });

}).to.throw(Error);
expect(function() {
p.reverseMergeSubstitutions(null);
}).to.throw(Error);
});

@@ -489,0 +486,0 @@ it('should accept no input', function() {

@@ -23,3 +23,6 @@ 'use strict';

if (data.hasOwnProperty(key)) {
if (data[key] && typeof data[key] === 'object') {
if (data[key] && Array.isArray(data[key])) {
merged[key] = data[key];
}
else if (data[key] && typeof data[key] === 'object') {
merged[key] = Object.assign({}, data[key]);

@@ -26,0 +29,0 @@ }

@@ -17,2 +17,3 @@ 'use strict';

b: 2,
arr: ['a', 'b'],
};

@@ -23,2 +24,3 @@ const obj2 = {

e: {f: 6},
arr: ['c'],
};

@@ -46,2 +48,8 @@

});
it('should overwrite arrays', function() {
expect(merged).to.have.property('arr');
expect(merged.arr).to.be.an.instanceof(Array);
expect(merged.arr).to.have.lengthOf(1);
expect(merged.arr[0]).to.equal('c');
});
});
{
"name": "@sendgrid/helpers",
"description": "SendGrid NodeJS internal helpers",
"version": "6.0.0-beta.5",
"version": "6.0.0",
"author": "SendGrid <dx@sendgrid.com> (sendgrid.com)",

@@ -6,0 +6,0 @@ "contributors": [

@@ -1,20 +0,42 @@

## Support classes and helpers for the Sendgrid NodeJS libraries
**This package is part of a monorepo, please see [this README](https://github.com/sendgrid/sendgrid-nodejs/blob/master/README.md) for details.**
# Support classes and helpers for the Sendgrid NodeJS libraries
This is a collection of classes and helpers used internally by the
Sendgrid NodeJS libraries.
[Sendgrid NodeJS libraries](https://www.npmjs.com/org/sendgrid).
Note that not all objects represented in the Sendgrid API have helper classes assigned to them, because it is not expected that developers will use these classes themselves. They are primarily for internal use and developers are expected to use the publicly exposed API in the various endpoint services.
Note that not all objects represented in the Sendgrid API have helper classes assigned to them, because it is not expected that developers will use these classes themselves. They are primarily for internal use and developers are expected to use the publicly exposed API in the [various endpoint services](https://www.npmjs.com/org/sendgrid).
### Mail class
Used to compose a Mail object that converts itself to proper JSON for use with the Sendgrid API. This class supports a slightly different API to make sending emails easier in many cases by not having to deal with personalization arrays, instead offering a simpler interface for composing mails.
To be notified when this package is updated, please subscribe to email [notifications](https://dx.sendgrid.com/newsletter/nodejs) for releases and breaking changes.
### Attachment class
Used by the inbound mail parser to compose Attachment objects.
## Mail class
Used to compose a `Mail` object that converts itself to proper JSON for use with the [Sendgrid v3 API](https://sendgrid.com/docs/API_Reference/api_v3.html). This class supports a slightly different API to make sending emails easier in many cases by not having to deal with personalization arrays, instead offering a simpler interface for composing mails.
### Personalization class
Used by the Mail class to compose Personalization objects.
## Attachment class
Used by the inbound mail parser to compose `Attachment` objects.
### Email address
Helper class to represent an email address with name/email. Used by both the Mail and Personalization classes to deal with email addresses of various formats.
## Personalization class
Used by the Mail class to compose `Personalization` objects.
### Helpers
## Email address
`Helper` class to represent an email address with name/email. Used by both the `Mail` and `Personalization` classes to deal with email addresses of various formats.
## Helpers
Internal helpers that mostly speak for themselves.
<a name="contribute"></a>
# How to Contribute
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-nodejs/blob/master/CONTRIBUTING.md) guide for details.
* [Feature Request](https://github.com/sendgrid/sendgrid-nodejs/tree/master/CONTRIBUTING.md#feature_request)
* [Bug Reports](https://github.com/sendgrid/sendgrid-nodejs/tree/master/CONTRIBUTING.md#submit_a_bug_report)
* [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-nodejs/tree/master/CONTRIBUTING.md#improvements_to_the_codebase)
<a name="about"></a>
# About
@sendgrid/helpers is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
@sendgrid/helpers is maintained and funded by SendGrid, Inc. The names and logos for @sendgrid/helpers are trademarks of SendGrid, Inc.
![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc