ti2 1.0.106 → 1.0.107

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.
@@ -51,13 +51,19 @@ const tokenTemplate = async (req, res, next) => {
51
51
  const thePlugin = req.app.plugins.find(({ name }) => name === pluginName);
52
52
  assert(thePlugin);
53
53
  let template = thePlugin.tokenTemplate();
54
- const safeRegExp = el => ({
55
- ...el,
56
- regExp: {
57
- flags: el.regExp.flags,
58
- source: el.regExp.source,
59
- },
60
- });
54
+ const safeRegExp = el => {
55
+ if (!el || !(el.regExp instanceof RegExp)) {
56
+ return el;
57
+ }
58
+
59
+ return {
60
+ ...el,
61
+ regExp: {
62
+ flags: el.regExp.flags,
63
+ source: el.regExp.source,
64
+ },
65
+ };
66
+ };
61
67
  template = R.map(safeRegExp, template);
62
68
  return res.json({
63
69
  template: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2",
3
- "version": "1.0.106",
3
+ "version": "1.0.107",
4
4
  "description": "Tourist Industry Exchange (TI2)",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test/plugin.js CHANGED
@@ -123,6 +123,11 @@ class Plugin {
123
123
  regExp: /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,
124
124
  description: 'Api Key',
125
125
  },
126
+ testMode: {
127
+ type: 'boolean',
128
+ default: false,
129
+ description: 'Use test mode',
130
+ },
126
131
  }));
127
132
  this.errorPathsAxiosErrors = jestPlugin.fn(() => ([
128
133
  ['response', 'data', 'what'],