mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Disable default styles for number input
This commit is contained in:
		
							
								
								
									
										20
									
								
								src/utils/objectHelpers.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/utils/objectHelpers.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
/** Return undefined if object has no keys, otherwise return object. */
 | 
			
		||||
export function undefinedIfEmpty(instance) {
 | 
			
		||||
    if (Object.keys(instance).length > 0) {
 | 
			
		||||
        return instance;
 | 
			
		||||
    }
 | 
			
		||||
    return undefined;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Return object without keys that have undefined value. */
 | 
			
		||||
export function withoutUndefinedKeys(instance) {
 | 
			
		||||
    return Object.keys(instance).reduce(
 | 
			
		||||
        (accumulator, key) => {
 | 
			
		||||
            if (instance[key] !== undefined) {
 | 
			
		||||
                accumulator[key] = instance[key];
 | 
			
		||||
            }
 | 
			
		||||
            return accumulator;
 | 
			
		||||
        },
 | 
			
		||||
        {},
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user