fixes JSONPath missing variable typo (#4754)

This commit is contained in:
Dimitri Mitropoulos 2022-05-03 12:57:22 -07:00 committed by GitHub
parent ef03a0feb9
commit b17df4a78d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
const os = require('os');
const {JSONPath} = require('jsonpath-plus');
const { JSONPath } = require('jsonpath-plus');
const FILTERABLE = ['userInfo', 'cpus'];
@ -32,9 +32,9 @@ module.exports.templateTags = [
run(context, fnName, filter) {
let value = os[fnName]();
if (jsonPath && FILTERABLE.includes(fnName)) {
if (JSONPath && FILTERABLE.includes(fnName)) {
try {
value = JSONPath({json: value, path: filter})[0];
value = JSONPath({ json: value, path: filter })[0];
} catch (err) {}
}