@sanity/schema
Advanced tools
Comparing version 0.103.11 to 0.103.12
@@ -6,2 +6,5 @@ 'use strict'; | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
exports.default = guessPreviewFields; | ||
@@ -48,21 +51,27 @@ var TITLE_CANDIDATES = ['title', 'name', 'label', 'heading', 'header', 'caption']; | ||
if (!titleField) { | ||
// last resort, pick all fields and concat them | ||
var fieldNames = fields.map(function (field) { | ||
return field.name; | ||
}); | ||
var fieldMapping = fieldNames.reduce(function (acc, fieldName) { | ||
acc[fieldName] = fieldName; | ||
return acc; | ||
}, {}); | ||
var _ret = function () { | ||
// last resort, pick all fields and concat them | ||
var fieldNames = fields.map(function (field) { | ||
return field.name; | ||
}); | ||
var fieldMapping = fieldNames.reduce(function (acc, fieldName) { | ||
acc[fieldName] = fieldName; | ||
return acc; | ||
}, {}); | ||
return { | ||
select: fieldMapping, | ||
prepare: function prepare(data) { | ||
return { | ||
title: fieldNames.map(function (name) { | ||
return name + ': ' + JSON.stringify(data[name]); | ||
}).join(' / ') | ||
}; | ||
} | ||
}; | ||
return { | ||
v: { | ||
select: fieldMapping, | ||
prepare: function prepare(data) { | ||
return { | ||
title: fieldNames.map(function (name) { | ||
return name + ': ' + JSON.stringify(data[name]); | ||
}).join(' / ') | ||
}; | ||
} | ||
} | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
} | ||
@@ -69,0 +78,0 @@ |
{ | ||
"name": "@sanity/schema", | ||
"version": "0.103.11", | ||
"version": "0.103.12", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133297
5133