@engage_so/core
Advanced tools
Comparing version 1.1.0 to 1.2.0
14
index.js
@@ -62,15 +62,19 @@ const fetch = require('cross-fetch') | ||
if (!o) { | ||
throw new EngageError('You need to pass an object with at least an id and email') | ||
throw new EngageError('You need to pass an object with at least an id and email.') | ||
} | ||
if (!o.id) { | ||
throw new EngageError('ID missing') | ||
throw new EngageError('ID missing.') | ||
} | ||
if (!o.email || !/^\S+@\S+$/.test(o.email)) { | ||
throw new EngageError('Email missing or invalid') | ||
if (o.email && !/^\S+@\S+$/.test(o.email)) { | ||
throw new EngageError('Email invalid.') | ||
} | ||
const allowed = ['id', 'email', 'number', 'created_at', 'device_token', 'device_platform', 'first_name', 'last_name'] | ||
const params = {} | ||
const params = { | ||
meta: {} | ||
} | ||
Object.keys(o).map(k => { | ||
if (allowed.indexOf(k) !== -1) { | ||
params[k] = o[k] | ||
} else { | ||
params.meta[k] = o[k] | ||
} | ||
@@ -77,0 +81,0 @@ }) |
{ | ||
"name": "@engage_so/core", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Event driven customer segmentation and targeted engagement.", | ||
@@ -20,3 +20,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "f1ddaf7b48dbdef18d531ce4cd36ab7f9d96ce6b" | ||
"gitHead": "6f62eb5e286f70648309fc5f157edf17ef32fc36" | ||
} |
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
7186
247