mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 03:43:34 +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;
 |