mirror of
https://github.com/strapi/strapi.git
synced 2025-08-11 18:27:22 +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;
|