mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Added function to filter object keys
This commit is contained in:
		@@ -18,3 +18,11 @@ export function withoutUndefinedKeys(instance) {
 | 
			
		||||
        {},
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Return copy of passed object that has only desired keys. */
 | 
			
		||||
export function onlySpecifiedKeys(object, desiredKeys) {
 | 
			
		||||
    return desiredKeys.reduce(
 | 
			
		||||
        (accumulator, key) => { accumulator[key] = object[key]; return accumulator; },
 | 
			
		||||
        {},
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user