Socket
Socket
Sign inDemoInstall

@adetoola/sms

Package Overview
Dependencies
7
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.1.0

dist/src/Strategies/TestStrategy.js

13

CHANGELOG.md

@@ -5,2 +5,15 @@ # Changelog

## [2.1.0](https://github.com/adetoola/sms/compare/v2.0.1...v2.1.0) (2020-06-07)
### Features
* add a TestStrategy ([a5cf5b9](https://github.com/adetoola/sms/commit/a5cf5b9e9996f0b6dbb0ae11a395260ab70ae59a))
### Bug Fixes
* duplicate formating for package.json ([b6a01d9](https://github.com/adetoola/sms/commit/b6a01d96551566f27a7d870a758e8cb26c1ca21f))
* getValidRecipients() should throw an error result is empty ([6c6e2c2](https://github.com/adetoola/sms/commit/6c6e2c27d567695434e3ca196d4ab1e4eec863a4))
### [2.0.1](https://github.com/adetoola/sms/compare/v2.0.0...v2.0.1) (2020-06-05)

@@ -7,0 +20,0 @@

4

dist/src/SMS.js

@@ -5,2 +5,3 @@ "use strict";

const SMSLive247Strategy_1 = require("./Strategies/SMSLive247Strategy");
const TestStrategy_1 = require("./Strategies/TestStrategy");
const InvalidArgsError_1 = require("./utils/errors/InvalidArgsError");

@@ -17,2 +18,5 @@ class SMS {

break;
case 'Test':
this._strategy = new TestStrategy_1.TestStrategy();
break;
default:

@@ -19,0 +23,0 @@ throw new Error('Unrecognised Gateway! Please check, your inputs');

5

dist/src/Strategies/SMSLive247Strategy.js

@@ -23,2 +23,5 @@ "use strict";

}
get batchSize() {
return this.MAX_MSG_GET;
}
async send(recipient, country, message, type = 'TEXT') {

@@ -30,3 +33,3 @@ const msg = this.sanitizeMessage(message);

const recipients = this.getValidRecipients(recipient, country);
const chunked = chunk_1.default(recipients, this.MAX_MSG_GET);
const chunked = chunk_1.default(recipients, this.batchSize);
return Promise.all(chunked.map(async (chk) => {

@@ -33,0 +36,0 @@ const url = build_url_1.default(this.api, {

@@ -22,3 +22,4 @@ "use strict";

const numbers = this.getUniqueRecipients(recipients);
const validRecipients = numbers.map((number) => {
const validRecipients = numbers
.map((number) => {
const phoneNumber = libphonenumber_js_1.parsePhoneNumber(number, country);

@@ -28,3 +29,7 @@ if (phoneNumber.isValid()) {

}
});
})
.filter(Boolean);
if (validRecipients.length === 0) {
throw new Error('No valid recipient in the input');
}
return validRecipients;

@@ -31,0 +36,0 @@ }

{
"name": "@adetoola/sms",
"version": "2.0.1",
"version": "2.1.0",
"private": false,

@@ -5,0 +5,0 @@ "description": "SMS is a succinct and flexible way to add Nigerian SMS providers integration to nodejs apps.",

@@ -32,2 +32,3 @@ # SMS

- [x] Test (Use as a test account)
- [x] SMS247Live

@@ -49,3 +50,3 @@ - [ ] XWireless

```env
# Log
# Test
SMS_SENDER='YOUR_SENDER_NAME_HERE'

@@ -52,0 +53,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc