From 743e76866076c83665dcac8d7170fb563f6cf05d Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Sun, 8 Jan 2017 00:42:12 -0800 Subject: [PATCH 1/2] Update to do a regexp match against the string to verify if it's an integer string or not. --- lib/influx.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/influx.js b/lib/influx.js index 759b17b..fecb19a 100644 --- a/lib/influx.js +++ b/lib/influx.js @@ -7,6 +7,8 @@ const internal = require('./internal'); const debug = require('./debug'); const util = require('./util'); +const influxInt = new RegExp("^[0-9]+i$"); + function convert(v) { if (!_.isString(v)) { return v; @@ -25,7 +27,7 @@ function isBoolean(v) { function formatFields(data) { return _.map(data, (v, k) => { - if (_.isString(v) && v.charAt(v.length - 1) !== 'i' && !isBoolean(v)) { + if (_.isString(v) && !influxInt.test(v) && !isBoolean(v)) { return `${convert(k)}="${v}"`; } return `${convert(k)}=${convert(v)}`; From 9b549fd654f7c50d10eb603275473ace4ee0cd5e Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Sun, 8 Jan 2017 01:00:45 -0800 Subject: [PATCH 2/2] Fixing a small patch for Travis wanting single quotes --- lib/influx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/influx.js b/lib/influx.js index fecb19a..c96e5bc 100644 --- a/lib/influx.js +++ b/lib/influx.js @@ -7,7 +7,7 @@ const internal = require('./internal'); const debug = require('./debug'); const util = require('./util'); -const influxInt = new RegExp("^[0-9]+i$"); +const influxInt = new RegExp('^[0-9]+i$'); function convert(v) { if (!_.isString(v)) {