server-reach-by-image
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -8,5 +8,7 @@ module.exports = { | ||
named: 'never' | ||
}], | ||
curly: ['error', 'multi'] | ||
}] | ||
}, | ||
env: { | ||
jest: true | ||
} | ||
}; |
11
index.js
@@ -19,4 +19,6 @@ const defaults = { | ||
return new Promise((resolve, reject) => { | ||
/* eslint-disable prefer-promise-reject-errors */ | ||
const fail = msg => reject({ msg: new Error(msg), status: false }); | ||
/* eslint-disable no-undef */ | ||
const img = new Image(); | ||
@@ -32,11 +34,14 @@ img.onload = () => resolve({ msg: null, status: true }); | ||
validateParams() { | ||
if (!this.options.url || !this.options.imgUrl) | ||
if (!this.options.url || !this.options.imgUrl) { | ||
throw new Error(errors.param_missing_urls); | ||
} | ||
this.options.url = this.options.url.replace(/\/+$/, ''); | ||
if (!this.options.imgUrl.startsWith('/')) | ||
if (!this.options.imgUrl.startsWith('/')) { | ||
this.options.imgUrl = `/${this.options.imgUrl}`; | ||
} | ||
if (!Number.isInteger(this.options.timeout)) | ||
if (!Number.isInteger(this.options.timeout)) { | ||
throw new Error(errors.param_timeout_integer); | ||
} | ||
} | ||
@@ -43,0 +48,0 @@ } |
{ | ||
"name": "server-reach-by-image", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Check can you reach a specific server (address or ip) by using image hosted on that server.", | ||
@@ -8,4 +8,4 @@ "main": "index.js", | ||
"release": "np --yolo", | ||
"test": "node_modules/.bin/jest", | ||
"lint": "eslint" | ||
"test": "jest", | ||
"lint": "eslint ." | ||
}, | ||
@@ -12,0 +12,0 @@ "repository": { |
# Server Reach By Image | ||
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/) | ||
[![license](https://img.shields.io/github/license/marinko-peso/shamus.svg)](https://github.com/marinko-peso/shamus/blob/master/LICENSE) | ||
![package version](https://img.shields.io/npm/v/server-reach-by-image.svg) | ||
[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg)](https://github.com/Flet/semistandard) | ||
[![package version](https://img.shields.io/npm/v/server-reach-by-image.svg)](https://npm.im/server-reach-by-image) | ||
@@ -16,3 +17,3 @@ Check can you reach a specific server (address or ip) by using image hosted on that server. | ||
```ssh | ||
npm install server-reach-by-image | ||
npm i server-reach-by-image | ||
``` | ||
@@ -19,0 +20,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24520
53
39