deepwalker
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -48,3 +48,3 @@ "use strict"; | ||
return ''; | ||
return transformer(instanceResult._result); | ||
return transformer(createResultsObject(instanceResult._result)); | ||
}, haveResults: function () { | ||
@@ -74,2 +74,9 @@ if (!instanceResult._result || instanceResult._result.length == 0) | ||
exports.deepwalker = deepwalker; | ||
function createResultsObject(results) { | ||
var newResultsObject = __spreadArray([], results, true); | ||
newResultsObject.getOne = function (dims) { | ||
return (results.find(function (result) { return !result.dimensions.filter(function (d, i) { return d !== dims[i]; }).length; }) || {}).value; | ||
}; | ||
return newResultsObject; | ||
} | ||
function walker(pathArray, object, result, i) { | ||
@@ -76,0 +83,0 @@ if (i === void 0) { i = 0; } |
@@ -41,3 +41,3 @@ | ||
if (!instanceResult._result || instanceResult._result.length == 0) return ''; | ||
return transformer(instanceResult._result) | ||
return transformer(createResultsObject(instanceResult._result)) | ||
}, | ||
@@ -70,2 +70,12 @@ haveResults: function () { | ||
function createResultsObject(results) { | ||
const newResultsObject = [...results] as any; | ||
newResultsObject.getOne = (dims) => { | ||
return (results.find((result) => !result.dimensions.filter((d, i) => d !== dims[i]).length) || {}).value | ||
} | ||
return newResultsObject | ||
} | ||
type DeepResult = { | ||
@@ -72,0 +82,0 @@ dimensions: Array<string>, |
{ | ||
"name": "deepwalker", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "", | ||
@@ -20,2 +20,2 @@ "main": "deepwalker.js", | ||
} | ||
} | ||
} |
11104
301