qranswers 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/qranswers.js CHANGED
@@ -5,6 +5,7 @@ const DEFAULT_BASE_PATH = 'v1';
5
5
  const DEFAULT_TIMEOUT = 80000;
6
6
  const DEFAULT_API_VERSION = null;
7
7
  QRAnswers.PACKAGE_VERSION = require('../package.json').version;
8
+ const utils = require('./utils');
8
9
  const ALLOWED_CONFIG_PROPERTIES = [
9
10
  'timeout',
10
11
  'host',
package/lib/utils.js ADDED
@@ -0,0 +1,13 @@
1
+ const utils = {
2
+ validateInteger: (name, n, defaultVal) => {
3
+ if (!Number.isInteger(n)) {
4
+ if (defaultVal !== undefined) {
5
+ return defaultVal;
6
+ } else {
7
+ throw new Error(`${name} must be an integer`);
8
+ }
9
+ }
10
+ return n;
11
+ },
12
+ }
13
+ module.exports = utils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qranswers",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Helper module to access QR-Answers API",
5
5
  "main": "lib/qranswers.js",
6
6
  "scripts": {