Creates a new object containing only the non-function properties from the original object.
function properties<T extends object>( object: T): Properties<T>Properties<T>Creates a new object containing only the non-function properties from the original object.
TProperties<T>Creates a new object containing only the non-function properties from the original object.
This function iterates through all enumerable properties of an object and returns a new object containing only those that are not functions.
const employee = {
id: 1,
name: 'John',
getFullName() { return this.name; },
calculateSalary() { return 50000; }
};
const dataProps = properties(employee);
// Result: { id: 1, name: 'John' }
