mirror of
https://github.com/strapi/strapi.git
synced 2025-08-10 09:47:46 +00:00
17 lines
339 B
JavaScript
17 lines
339 B
JavaScript
'use strict';
|
|
|
|
const _ = require('lodash');
|
|
|
|
const checkFieldsDontHaveDuplicates = fields => {
|
|
if (_.isNil(fields)) {
|
|
// Only check if the fields exist
|
|
return true;
|
|
} else if (!Array.isArray(fields)) {
|
|
return false;
|
|
}
|
|
|
|
return _.uniq(fields).length === fields.length;
|
|
};
|
|
|
|
module.exports = checkFieldsDontHaveDuplicates;
|