Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 8f74fef

Browse files
authored
Merge pull request ckan#5091 from howff/patch-2
parseCompletions handles v3 api result
2 parents 8c40f39 + a84859e commit 8f74fef

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ckan/public/base/javascript/client.js

+6
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@
160160
}
161161

162162
var map = {};
163+
// If given a 'result' array then convert it into a Result dict inside a Result dict.
164+
// new syntax (not used until all browsers support arrow notation):
165+
//data = data.result ? { 'ResultSet': { 'Result': data.result.map(x => ({'Name': x})) } } : data;
166+
// compatible syntax:
167+
data = data.result ? { 'ResultSet': { 'Result': data.result.map(function(val){ return { 'Name' :val } }) } } : data;
168+
// If given a Result dict inside a ResultSet dict then use the Result dict.
163169
var raw = jQuery.isArray(data) ? data : data.ResultSet && data.ResultSet.Result || {};
164170

165171
var items = jQuery.map(raw, function (item) {

0 commit comments

Comments
 (0)