avoid importing all of lodash to reduce the bundle size

This commit is contained in:
Apollinaire 2018-12-19 14:45:36 +01:00
parent b50fb7b363
commit 149932a6b8

View file

@ -2,7 +2,8 @@
* Schema converter/getters
*/
import Users from 'meteor/vulcan:users';
import _ from 'lodash';
import _filter from 'lodash/filter';
import _keys from 'lodash/keys';
/* getters */
// filter out fields with "." or "$"
@ -33,7 +34,7 @@ export const getUpdateableFields = schema => {
* @param {Object} user the user for which to check field permissions
*/
export const getInsertableFields = function(schema, user) {
const fields = _.filter(_.keys(schema), function(fieldName) {
const fields = _filter(_keys(schema), function(fieldName) {
var field = schema[fieldName];
return Users.canCreateField(user, field);
});