@fakel/rest-admin
Version:
An application that makes it easier to work with your API
14 lines (13 loc) • 397 B
JavaScript
import get from 'lodash.get';
import { v4 as uuid } from 'uuid';
export var mapRecordsToOptions = function (records, source, titlePropName) {
return records.map(function (record, index) {
var value = get(record, source);
var title = get(record, titlePropName);
return {
key: uuid(),
value: value,
title: title,
};
});
};