Socket
Socket
Sign inDemoInstall

mailgun.js

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailgun.js - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

examples/addresses.js

10

lib/client.js

@@ -14,2 +14,4 @@ 'use strict';

var MessagesClient = require('./messages');
var ValidateClient = require('./validate');
var ParseClient = require('./parse');

@@ -37,2 +39,10 @@ class Client {

this.messages = new MessagesClient(this.request);
if (config.public_key) {
config.key = config.public_key;
this.public_request = new Request(config);
this.validate = new ValidateClient(this.public_request);
this.parse = new ParseClient(this.public_request);
}
}

@@ -39,0 +49,0 @@ }

2

package.json
{
"name": "mailgun.js",
"version": "1.2.0",
"version": "1.3.0",
"main": "index.js",

@@ -5,0 +5,0 @@ "author": "Mailgun",

@@ -69,2 +69,6 @@ # Mailgun.js [![Build Status](https://travis-ci.org/mailgun/mailgun-js.svg)](https://travis-ci.org/mailgun/mailgun-js)

- [destroy](#destroy-1)
- [validate](#validate)
- [get](#get-4)
- [parse](#parse)
- [get](#get-5)

@@ -872,2 +876,53 @@ Method naming conventions:

### validate
#### get
`mg.validate.get(address)`
Example:
```js
mg.validate.get('alice@example.com')
.then(data => console.log(data)) // logs response body
.catch(err => console.log(err)); // logs any error
```
Promise Returns: response body
```
{
address: 'alice@example.com',
did_you_mean: null,
is_valid: false,
parts: { display_name: null, domain: null, local_part: null }
}
```
### parse
#### get
`mg.parse.get(addresses, enableDnsEspChecks)`
Example:
```js
mg.parse.get('Alice <alice@example.com>, example.com', true)
.then(data => console.log(data)) // logs response body
.catch(err => console.log(err)); // logs any error
```
Promise Returns: response body
```
{
parsed: [],
unparseable: [
'Alice <alice@example.com>',
'example.com'
]
}
```
## Browser Demo

@@ -874,0 +929,0 @@

@@ -7,3 +7,5 @@ var Client = require('../lib/client');

var SuppressionClient = require('../lib/suppressions');
var MessagesClient = require('../lib/messages')
var MessagesClient = require('../lib/messages');
var ValidateClient = require('../lib/validate');
var ParseClient = require('../lib/parse');

@@ -14,3 +16,3 @@ describe('Client', function() {

beforeEach(function() {
client = new Client({ username: 'username', key: 'key' });
client = new Client({ username: 'username', key: 'key', public_key: 'key' });
});

@@ -53,2 +55,10 @@

});
it('creates address validate client', function() {
client.validate.should.be.instanceOf(ValidateClient);
});
it('creates address parse client', function() {
client.parse.should.be.instanceOf(ParseClient);
});
});

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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