Task: Implement a pure function to remove private keys from an object
Location: /app/
What to implement
Create a module that exports a function removePrivateKeys(obj) which returns a new object containing only the public keys from the input object. A public key is any key that does not start with an underscore (_). Private keys (starting with _) must be omitted from the result.
The function must not mutate the input object. It should be pure and return a newly constructed object.
Behavior requirements:
If obj is null, undefined, or not an object, return an empty object {}.
For an empty object {}, return {}.
If all keys are private (start with _), return {}.
If no keys are private, return an object containing all original key-value pairs (same values, same keys).
For mixed objects, include only the keys that do not start with _.
Implementation details:
Only consider own enumerable properties (no inherited properties).
Use a straightforward iteration (e.g., Object.keys(obj)) to build the result.
Export: Use CommonJS module.exports so the function can be required by the test suite.