Files

17 lines
393 B
JavaScript
Raw Permalink Normal View History

2017-01-05 15:50:05 +01:00
'use strict';
2016-05-11 09:22:13 +02:00
const jsonPathPlus = require('jsonpath-plus');
2016-03-18 19:49:27 +01:00
const debugLog = require('./debugLog');
2016-04-07 15:17:11 +02:00
/*
Just a wrapper around an external dependency for debugging purposes
*/
2016-03-18 19:49:27 +01:00
module.exports = function jsonPath(json, path) {
2016-11-02 19:21:11 -03:00
2016-05-11 09:22:13 +02:00
debugLog('Calling jsonPath:', path);
const result = jsonPathPlus({ json, path, wrap: true })[0];
debugLog('jsonPath resolved:', result);
2016-03-18 19:49:27 +01:00
return result;
};