free-mobile-api-node
Advanced tools
Comparing version 1.0.0 to 1.0.1
14
index.js
@@ -1,7 +0,11 @@ | ||
async function FreeMobileSms(user, pass, message) { | ||
export default async function FreeMobileSms(user, pass, message) { | ||
if (!user || !pass || !message) { | ||
return new Error('Missing user, pass or message') | ||
} | ||
const url = `https://smsapi.free-mobile.fr/sendmsg?user=${user}&pass=${pass}&msg=${encodeURIComponent(message)}` | ||
const response = await fetch(url, { mode: 'no-cors' }) | ||
const err = response.error | ||
const err = response.error || response.headers.get('X-Error') | ||
@@ -12,5 +16,3 @@ if (err) { | ||
return true | ||
} | ||
module.exports = FreeMobileSms | ||
return new Response(response, { status: 200 }) | ||
} |
{ | ||
"name": "free-mobile-api-node", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A Node.js module to send SMS using the Free Mobile API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# free-mobile-api-node | ||
A Node.js module to send SMS using the Free Mobile API | ||
A Node.js module to send SMS using the Free Mobile API | ||
## Usage/Examples | ||
```bash | ||
npm i free-mobile-api-node | ||
``` | ||
```javascript | ||
import FreeMobileSms from 'free-mobile-api-node' | ||
FreeMobileSms(user_id, pass, message) | ||
``` |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
1423
11
16
1